public static double CalculationDistance(Point3D p1, Point3D p2) { double distance = Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y) + (p1.Z - p2.Z) * (p1.Z - p2.Z)); return distance; }
static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Point3D firstTestPoint = new Point3D(1.5, 2.5, 3.5); Point3D secondTestPoint = new Point3D(-1, -4, 7); Point3D thirdTestPoint = new Point3D(1, 2, 3); Path testPath = new Path(); testPath.AddPoint(firstTestPoint); testPath.AddPoint(secondTestPoint); testPath.AddPoint(thirdTestPoint); PathStorage.SavePath(testPath, "sample"); //saving the test points to the file "pathsample.txt" Path loadedPath = PathStorage.LoadPath(@"../../pathsample.txt"); //loading the saved file and printing the points for (int i = 0; i < loadedPath.PathList.Count; i++) { Console.WriteLine(loadedPath.PathList[i]); } }
// Problem 2 static Point3D() { o = new Point3D(0, 0, 0); }
public void Remove(Point3D point) { this.PathList.Remove(point); }
public void AddPoint(Point3D point) { this.PathList.Add(point); }