public static void LoadingPathFromFile(string textFile) { using (StreamReader readerOfFile = new StreamReader("LoaderTextFile.txt")) { string path; while ((path = readerOfFile.ReadLine()) != null) { string[] coordinates = path.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); Path newPath = new Path(); for (int i = 0; i < coordinates.Length; i = i + 3) { Point3D newPoint = new Point3D(double.Parse(coordinates[i]), double.Parse(coordinates[i + 1]), double.Parse(coordinates[i + 2])); newPath.SequenceOf3Dpoints.Add(newPoint); } paths.Add(newPath); } } }
public static double CalculateDistanceBetween23DPoints(Point3D firstPoint, Point3D secondPoint) { return 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)); }