public static double Distance(Point3D firstPoint, Point3D secondPoint) { int xDistanceSquare = GetDistanceSquare(firstPoint.X, secondPoint.X); int yDistanceSquare = GetDistanceSquare(firstPoint.Y, secondPoint.Y); int zDistanceSquare = GetDistanceSquare(firstPoint.Z, secondPoint.Z); return Math.Sqrt(xDistanceSquare + yDistanceSquare + zDistanceSquare); }
static void Main(string[] args) { Point3D pointA = new Point3D(3, 4, 5); Point3D pointB = new Point3D(3, 4, 4); Console.WriteLine("point A: {0}", pointA); Console.WriteLine("point B: {0}", pointB); Console.Write("\nDistance between point A & B: "); Console.WriteLine(Point3DMath.Distance(pointA, pointB)); Path path = new Path(); path.Points3D.Add(pointA); path.Points3D.Add(pointB); Console.WriteLine("\nSave path. . ."); PathStorage.Save(path); path = null; path = PathStorage.Load(); Console.WriteLine("\nLoaded path content:"); PrintPath(path); Console.WriteLine(); }