Praeclarum.Graphics.StrokeSegment.GetClosestPoint C# (CSharp) Method

GetClosestPoint() public method

public GetClosestPoint ( PointF p ) : int
p PointF
return int
		public int GetClosestPoint (PointF p/*, out float dist*/)
		{
			var minIndex = -1;
			var minDist = 0.0f;

			for (var i = StartIndex; i <= EndIndex; i++) {

				var d = _points [i].DistanceTo (p);

				if (minIndex == -1 || (d < minDist)) {
					minIndex = i;
					minDist = d;
				}				
			}

			//dist = minDist;
			return minIndex;
		}