public static double CalculateDistance(Structure3D first, Structure3D second) { double distance = 0; distance = Math.Sqrt(Math.Pow(first.PositionX - second.PositionX, 2) + Math.Pow(first.PositionY - first.PositionY, 2) + Math.Pow(first.PositionZ - first.PositionZ, 2)); return distance; }
static void Main(string[] args) { Structure3D firstPoint = new Structure3D(1, 2, 3); Structure3D secondPoint = new Structure3D(0, 8, 1); Path firstPath = new Path(); firstPath.AddPoint(firstPoint); firstPath.AddPoint(secondPoint); PathStorage.SavePaths(firstPath); List<Path> pathList = PathStorage.ReadPaths(); }
public static List<Path> ReadPaths() { Path readPaths = new Path(); List<Path> pathsLoaded = new List<Path>(); string pathRead = "Paths.txt"; StreamReader reader = new StreamReader(pathRead); using (reader) { string line = reader.ReadLine(); while (line != null) { Structure3D point = new Structure3D(); string[] points = line.Split(','); point.PositionX = int.Parse(points[0]); point.PositionY = int.Parse(points[1]); point.PositionZ = int.Parse(points[2]); readPaths.AddPoint(point); line = reader.ReadLine(); } } return pathsLoaded; }
//Methods public void AddPoint(Structure3D point) { sequenceOfPoints.Add(point); }