static void Main() { Point3D point = new Point3D(1, 2, 3); Console.WriteLine(point); Console.WriteLine(Point3D.PointZero); Console.WriteLine(); var distance = CalculateDistanceBetweenTwoPoints.CalculateDistance(point, Point3D.PointZero); var path = new Path(); for (int i = 0; i < 10; i++) { path.AddPoint(new Point3D() { X = i, Y = i * 2, Z = i + 3 }); } string filePath = @"../../path.txt"; PathStorage.SavePath(path, filePath); var fromFile = PathStorage.LoadPath(filePath); foreach (var p in fromFile) { Console.WriteLine(point); } }
public static double CalculateDistance(Point3D firstPoint, Point3D secondPoint) { double distance = 0.0; distance = Math.Sqrt( (firstPoint.X - secondPoint.X) * (firstPoint.X - secondPoint.X) + (firstPoint.Y - secondPoint.Y) * (firstPoint.Y - secondPoint.Y) + (firstPoint.Z - secondPoint.Z) * (firstPoint.Z - secondPoint.Z)); return distance; }