public static List<Point3D> LoadPathFromFile() { List<Point3D> loaded = new List<Point3D>(); using (StreamReader reader = new StreamReader(@".../.../LoadFromhere.txt")) { string line = reader.ReadLine(); while (line !=null) { string[] coord = line.Split('[', ',', ']',' '); List<int> coordinates = new List<int>(); for (int i = 0; i < coord.Length ; i++) { int someInt; if (int.TryParse(coord[i], out someInt)) { coordinates.Add(someInt); } } Point3D point = new Point3D(); point.CoordinateX = coordinates[0]; point.CoordinateY = coordinates[1]; point.CoordinateZ = coordinates[2]; loaded.Add(point); line = reader.ReadLine(); } } return loaded; }
public List<Point3D> AddPointInPath(Point3D somePoint) { pointsInPath.Add(somePoint); return pointsInPath; }
public static double GiveMeDistance(Point3D firstPoint, Point3D secondPoint) { double distance = Math.Sqrt(Math.Pow(firstPoint.CoordinateX - secondPoint.CoordinateX, 2) + Math.Pow(firstPoint.CoordinateY - secondPoint.CoordinateY, 2) + Math.Pow(firstPoint.CoordinateZ - secondPoint.CoordinateZ, 2)); return distance; }