AForge.IntPoint.DistanceTo C# (CSharp) Method

DistanceTo() public method

Calculate Euclidean distance between two points.
public DistanceTo ( IntPoint anotherPoint ) : float
anotherPoint IntPoint Point to calculate distance to.
return float
		public float DistanceTo( IntPoint anotherPoint )
		{
			int dx = X - anotherPoint.X;
			int dy = Y - anotherPoint.Y;

			return (float) System.Math.Sqrt( dx * dx + dy * dy );
		}

Usage Example

Example #1
0
 public void Add(IntPoint point)
 {
     if (Points.Count != 0)
     {
         Length += point.DistanceTo(Points.Last());
     }
     Points.Add(point);
 }
All Usage Examples Of AForge.IntPoint::DistanceTo