static void Main(string[] args) { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Point3D pointA = new Point3D(1.5, 2.5, 3.5); Point3D pointB = new Point3D(-1, -4, 7); Point3D pointC = new Point3D(1, 2, 3); Point3D pointD = new Point3D(-1, -2, 3); Point3D pointE = new Point3D(1.25, 2.375, 33.9); Path testPath = new Path(); testPath.AddPoint(pointA); testPath.AddPoint(pointB); testPath.AddPoint(pointC); testPath.AddPoint(pointD); testPath.AddPoint(pointE); PathStorage.SavePath(testPath, @"../../pathsample.txt"); Path loadedPath = PathStorage.LoadPath(@"../../pathsample.txt"); for (int i = 0; i < loadedPath.PathList.Count; i++) { Console.WriteLine(loadedPath.PathList[i]); } Console.WriteLine("Distanse between point A and point B is {0}", DistanceBetweenTowPoints.DistanceBetweenPoints(pointA, pointB)); }
public static double DistanceBetweenPoints(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; }
public static double DistansBetweenTowPoints(Point3D a, Point3D b) { double diatance = 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 diatance; }
public void RemovePoint(Point3D point) { this.pathList.Remove(point); }
public void AddPoint(Point3D point) { this.pathList.Add(point); }
public void AddPoint(Point3D p) { this.points.Add(p); }