예제 #1
0
        static void Main(string[] args)
        {
            Point3D p1 = new Point3D(2, 2, 1);
            Point3D p2 = new Point3D(4, 4, 3);

            Console.WriteLine( DistanceCalculator.CalculateTheDistance(p1, p2));
        }
 public static double CalculateTheDistance(Point3D one, Point3D two)
 {
     //d = \sqrt {(4 - 1)^2 + (5 - 2)^2 + (6 - 3)^2}
     return Math.Sqrt
         (
         Math.Pow((two.X - one.X), 2) +
         Math.Pow((two.Y - one.Y), 2) +
         Math.Pow((two.Z - one.Z), 2)
         );
 }