Get distance between two points
using System; namespace ComputationalGeometry.Shapes { public static class MathUtility { /// <summary> /// Calculates the distance between two points. /// </summary> /// <param name="p1">First point.</param> /// <param name="p2">Second point.</param> /// <returns>The distance between two points.</returns> public static double GetDistance(Point2D p1, Point2D p2) { double xDelta = p1.X - p2.X; double yDelta = p1.Y - p2.Y; return Math.Sqrt(Math.Pow(xDelta, 2) + Math.Pow(yDelta, 2)); } } }