public static List<Path3D> Load() { string lineSeparator = "---"; Path3D loadPath = new Path3D(); List<Path3D> loaded = new List<Path3D>(); using (StreamReader reader = new StreamReader(@"../../Loads.txt")) { string line = reader.ReadLine(); while (line != null) { if (line != lineSeparator) { Point3D point = new Point3D(); string[] points = line.Split(','); point.X = int.Parse(points[0]); point.Y = int.Parse(points[1]); point.Y = int.Parse(points[2]); loadPath.AddPoint(point); } else { loaded.Add(loadPath); loadPath = new Path3D(); } line = reader.ReadLine(); } } return loaded; }
static void Main() { Path myPath = PathStorage.LoadPath(@"..\..\path.txt"); Console.WriteLine(myPath); Point3D zero = Point3D.GetPointO; Point3D testPoint = new Point3D(6, 2, 1); Console.WriteLine("The distance between {0} and {1} is {2:0.00}", zero, testPoint, DistanceIn3DSpace.CalculateDistanceBetween(zero, testPoint)); PathStorage.SavePath(myPath, @"..\..\output.txt"); }
private static void Main() { var myPath = PathStorage.LoadPath(@"..\..\path.txt"); Console.WriteLine(myPath); var zero = Point3D.PrintO; var testPoin = new Point3D(6, 7, 1); Console.WriteLine("Distance between {0} and {1} is {2:0.00}", zero, testPoin, Distance.CalculateDistance(zero, testPoin)); PathStorage.PathToSave(myPath, @"..\..\output.txt"); }
static void Main() { Point3D point1 = new Point3D(3 ,4 ,5); Point3D point2 = new Point3D(3, 6, 5); Point3D point3 = new Point3D(3, 7, 2); Console.WriteLine(point1.ToString()); Console.WriteLine(point2.ToString()); Console.WriteLine(point3.ToString()); List<Path3D> listPathsTest = PathStorage3D.Load(); foreach (Path3D path in listPathsTest) { PathStorage3D.Save(path); foreach (var listPoints in path.PathPoints) { Console.WriteLine(listPoints.ToString()); } } }
public static double CalculateDistance(Point3D a, Point3D b) { return Math.Sqrt((a.PointX - b.PointX) * (a.PointX - b.PointX) + (a.PointY - b.PointY) * (a.PointY - b.PointY) + (a.PointZ - b.PointZ) * (a.PointZ - b.PointZ)); }
public void AddPoint(Point3D point) { pathPoints.Add(point); }
public static double CalcDistance3D(Point3D point1,Point3D point2) { double distance = 0; return distance = Math.Sqrt(Math.Pow(point1.X - point2.X, 2) + Math.Pow(point1.Y - point2.Y, 2)); }
public static double CalculateDistanceBetween(Point3D a, Point3D b) { return 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)); }
public void AddPath(Point3D input) { pointList.Add(input); }
public void RemovePoint(Point3D point) { this.pointList.Remove(point); }
public void AddPoint(Point3D point) { this.pointList.Add(point); }