Distance Between Points - CSharp System

CSharp examples for System:Math Geometry

Description

Distance Between Points

Demo Code


using System.Windows.Media;
using System.Windows;
using System;//w  ww  .j a  v  a  2s . c  o m

public class Main{
        public static double DistanceBetweenPoints(Point point1, Point point2)
        {
            double d = Math.Sqrt(Math.Pow(point2.X - point1.X, 2) + Math.Pow(point2.Y - point1.Y, 2));
            return d;
        }
}

Related Tutorials