Euclidean Distance for two points - CSharp System

CSharp examples for System:Math Geometry

Description

Euclidean Distance for two points

Demo Code


using System;/* w ww  .  j  ava 2  s. co m*/

public class Main{
        public static double EuclideanDistance(Point p1, Point p2)
      {
         return Math.Abs(Math.Sqrt((p1.X-p2.X)*(p1.X-p2.X)+(p1.Y-p2.Y)*(p1.Y-p2.Y)));
      }
}

Related Tutorials