コード例 #1
0
        static void Main()
        {
            Point3D a = new Point3D(5, 12, 34);
            Point3D b = new Point3D(23, 44, -1);

            double distance = Calculator.EuclideanDistanceBetweenPoints(a, b);
            Console.WriteLine(distance);
        }
コード例 #2
0
 public static double EuclideanDistanceBetweenPoints(Point3D a, Point3D b)
 {
     double distance = Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y) + (a.Z - b.Z) * (a.Z - b.Z));
     return distance;
 }