CSharp examples for System:Math Geometry
Calculates the distance between the current and the target point in pixel
using System.Windows; using System;/*www . j a va 2 s. c om*/ public class Main{ /// <summary> /// Calculates the distance between the current and the target point in pixel /// </summary> /// <param name="currentPoint">The current point.</param> /// <param name="targetPoint">The target point.</param> /// <returns>The calculated distance</returns> public static double DistanceTo(this Point currentPoint, Point targetPoint) { var a = targetPoint.X - currentPoint.X; var b = targetPoint.Y - currentPoint.Y; return Math.Sqrt((a * a) + (b * b)); } }