static void Main(string[] args) { Console.WriteLine(new Point3D(2, 5, 6)); // point test Console.WriteLine(Distance.CalcDistance(new Point3D(5, 6, 7), new Point3D(2, 1, 8))); // distance calculation test var path = new Path(new Point3D(1, 2, 3), new Point3D(4, 6, 8), new Point3D(9, 5, 3)); // path test Console.WriteLine(path); PathStorage.WritePath(path, "../../PathFile.txt"); // writing path to file Console.WriteLine("Reading path from file... \n{0}", PathStorage.LoadPath("../../PathFile.txt")); // reading path from file }
public static void Main() { Console.WriteLine(Point3D.OriginPointO); Console.WriteLine(new string('-', 25)); double testDistance = Distance.CalculateDistanceBetweenTwoPoints(Point3D.OriginPointO, new Point3D(2, 4, 13)); Console.WriteLine(testDistance); Console.WriteLine(new string('-', 25)); PathStorage.LoadPaths(); PathStorage.PrintPaths(); PathStorage.SavePath(); PathStorage.PrintPaths(); }
public static void TestTask4() { Path test1 = new Path(); test1.AddPoint(); test1.AddPoint(new Point(1, 2, 3)); test1.AddPoint(4, 5, 6); Console.WriteLine(test1); // testing toString for a path PathStorage.WritePathToFile("test.txt", test1); Path readFromFile = PathStorage.ReadPathFromFile("test.txt"); Console.WriteLine(readFromFile); }
public static void Main() { var firstPoint = new Point3D(1, 2, 3); var secondPoint = new Point3D(2, 3, 4); var thirdPoint = new Point3D(3, 4, 5); var forthPoint = new Point3D(4, 5, 6); Console.WriteLine("Created 4 test point and printing them on the console:"); Console.WriteLine(firstPoint); Console.WriteLine(secondPoint); Console.WriteLine(thirdPoint); Console.WriteLine(forthPoint); Console.WriteLine("\nPrintitng start point:"); Console.WriteLine(Point3D.StartPoint); Console.WriteLine("\nCalculating the distance between the two points:"); Console.WriteLine(firstPoint); Console.WriteLine(secondPoint); Console.WriteLine("Distance: " + Point3DCalculations.CalculateDistance(firstPoint, secondPoint)); var firstPath = new Path(); firstPath.AddPoint(firstPoint); firstPath.AddPoint(secondPoint); var secondPath = new Path(); secondPath.AddPoint(thirdPoint); secondPath.AddPoint(forthPoint); var paths = new List <Path>(); paths.Add(firstPath); paths.Add(secondPath); PathStorage.SavePathsToFile(paths); Console.WriteLine("\nSucssesfuly saved paths to the following file:\n " + System.IO.Path.GetFullPath(PathStorage.SaveFilePath)); var pathsLoadedFromFile = PathStorage.LoadPathsFromFile(); Console.WriteLine("\nPrinting the points read from the paths saved in the following file:\n " + System.IO.Path.GetFullPath(PathStorage.LoadFilePath)); foreach (var path in pathsLoadedFromFile) { foreach (var point3d in path.PointsPath) { Console.WriteLine(point3d.ToString()); } } }
static void Main() { Path newPath = PathStorage.LoadFile(); Point3DCoord point = new Point3DCoord(5, 10, 15); newPath.InsertPoint(point); foreach (var item in newPath.pathToSequence) { Console.WriteLine(item.ToString()); } PathStorage.SaveFile(newPath); Point3DCoord firstPoint = new Point3DCoord(1, 1, 2); Point3DCoord secondPoint = new Point3DCoord(2, 1, 1); Console.WriteLine(CalculateDistance.DistanceCalculation(firstPoint, secondPoint)); }
static void Main() { //just for testing the classes and structures Path newPath = PathStorage.LoadFile(); Point3DCoordinates point = new Point3DCoordinates(1, 2, 6); newPath.AddPoint(point); foreach (var item in newPath.path) { Console.WriteLine(item.ToString()); } PathStorage.SaveFile(newPath); Point3DCoordinates first = new Point3DCoordinates(1, 2, 3); Point3DCoordinates second = new Point3DCoordinates(1, 5, 8); Console.WriteLine(Distance.DistanceBetweenPoints(first, second)); }
public static void Main() { var point = new Point3D(4.5, 8.4, 9.6); var anotherPoint = new Point3D(5.8, 9.7, 0.3); double distance = PointDistance.Distance(point, anotherPoint); Console.WriteLine(distance); Console.WriteLine(point); Console.WriteLine(Point3D.PointO); Console.WriteLine(new string('-', 50)); Path testPath = new Path(); Point3D point1 = new Point3D(1.5, 2.5, 3.5); Point3D point2 = new Point3D(-1, 2, 7); Point3D point3 = new Point3D(4, 2, 3); Point3D point4 = new Point3D(-5, -4, 3); Point3D point5 = new Point3D(1.25, 2.375, 3); testPath.AddPoint(point1); testPath.AddPoint(point2); testPath.AddPoint(point3); testPath.AddPoint(point4); testPath.AddPoint(point5); PathStorage.SavePath(testPath, "sample"); Path loadedPath = PathStorage.LoadPath(@"../../pointsample.txt"); Console.WriteLine("The points from the text file are: "); for (int i = 0; i < loadedPath.PointList.Count; i++) { Console.WriteLine("Point {0}: {1}", i + 1, loadedPath.PointList[i].ToString()); } }