static void Main() { Point3D myPoint = new Point3D(1, 2, 3); Console.WriteLine("The ToString() overload: {0}", myPoint); Console.WriteLine(); Console.WriteLine("The static point 0: {0}", Point3D.CentrePoint); Console.WriteLine(); Point3D myOtherPoint = new Point3D(3, 2, 1); double pointsDistance = CalculateDistance.Distance(myPoint, myOtherPoint); Console.WriteLine("Calculated distance: {0}", pointsDistance); Console.WriteLine(); Path route = new Path(); route.AddPoint(Point3D.CentrePoint); route.AddPoint(myPoint); route.AddPoint(myOtherPoint); route.AddPoint(new Point3D(1.1, 2.2, 3.82743658793465)); Console.WriteLine("One of the points in the path: {0}", route.PointsPath[1]); Console.WriteLine(); PathStorage.SavePath(route, "../../test.txt"); Path loadedRoute = PathStorage.LoadPath("../../test.txt"); Console.WriteLine("Print path loaded from file"); foreach (var point in loadedRoute.PointsPath) { Console.WriteLine(point); } }
static void Main() { Point3D p1 = new Point3D(1, 2, 3); Point3D p2 = new Point3D(4, 5, 6); Console.WriteLine("Distance between ({0}) and ({1}) = {2}", p1, p2, Distance.Calculate(p1, p2)); Path path = new Path(); path.AddPoint(p1); path.AddPoint(p2); PathStorage.Save(path, @"../../pointList.txt"); PathStorage.Load(@"../../pointList.txt"); }
static void Main() { Console.Write("point zero: "); Console.WriteLine(Point3D.CoordSystemStart); Console.WriteLine(); //Testing distnace class Console.WriteLine("Print some distances:"); double dist1 = Calc3Ddistance.CalcDistance(new Point3D(1, 6, 5), new Point3D(4, 3, 5)); Console.WriteLine("distance = {0:00.000} ",dist1); dist1 = Calc3Ddistance.CalcDistance(new Point3D(-1, 6, -5), new Point3D(4, -3, 5)); Console.WriteLine("distance = {0:00.000} ", dist1); dist1 = Calc3Ddistance.CalcDistance(new Point3D(-10, 61, 52), new Point3D(124, 398, -545)); Console.WriteLine("distance = {0:00.000} ", dist1); //Testing Path class Path path1 = new Path(); path1.AddPointToPath(new Point3D(1, 2, 3)); path1.AddPointToPath(new Point3D(1, 3, 4)); path1.AddPointToPath(new Point3D(6, 3, 1)); path1.AddPointToPath(new Point3D(7, 9, 13)); path1.AddPointToPath(new Point3D(15, 24, 31)); Console.WriteLine("Printing path1"); path1.PrintPath(); Console.WriteLine(); //saveing path1 to file PathStorage.SavePathToFile("Saved Path.txt", path1, false); //load path1 from file Path loadedPath = PathStorage.LoadPathFromFile("Saved Path.txt"); Console.WriteLine("printing loadedPath"); loadedPath.PrintPath(); // testing attributes Console.WriteLine("Testing attributes"); Type t = typeof(Point3D); Type tVersion = typeof(Version); Version version = (Version)Attribute.GetCustomAttribute(t, tVersion); Console.WriteLine(version.CurrentVersion); }
public static void Main() { Point3D a = new Point3D(2.26, 10.8, -5); Console.WriteLine("Point A {0}", a); Console.WriteLine("Origin {0}", Point3D.Origin); Point3D b = new Point3D(2, 8, -1); Console.WriteLine("Point B {0}", b); Console.WriteLine("The distance between A and B is {0}", Distance.CalculateDistance(a, b)); Path path = new Path(Point3D.Origin, a, b, a, b); path.AddPoint(Point3D.Origin); path.AddPoint(new Point3D(-9.99, -8, 0)); Console.WriteLine("The path is:\n{0}", path); PathStorage.SavePathToFile(@"..\..\path.txt", path); Path loadedPath = PathStorage.LoadPathFromFile(@"..\..\path.txt"); }
static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Console.WriteLine("Creating Points"); Console.WriteLine(new string('-', 30)); var firstPoint = new Point3D(2.3, 5, 0); Console.WriteLine("First point: {0}", firstPoint); var zeroPoint = Point3D.ZeroPoint; Console.WriteLine(new string('-', 30)); Console.WriteLine("Zero point: {0}", zeroPoint); var distance = PointsDistance.CalculateDistance(firstPoint, zeroPoint); Console.WriteLine(new string('-', 30)); Console.WriteLine("Distance between the points: {0:F2} ", distance); var path = new Path(); Console.WriteLine(new string('-', 30)); Console.WriteLine("Creating path."); path.AddPoint(firstPoint); Console.WriteLine(new string('-', 30)); Console.WriteLine("Adding first point."); path.AddPoint(zeroPoint); Console.WriteLine(new string('-', 30)); Console.WriteLine("Adding zero point."); Console.WriteLine(new string('-', 30)); Console.WriteLine("Path: {0}", path.ToString()); Console.WriteLine(new string('-', 30)); Console.WriteLine("Total points in path: {0}", path.Count); path.RemovePoint(zeroPoint); Console.WriteLine(new string('-', 30)); Console.WriteLine("Removing zero point."); Console.WriteLine(new string('-', 30)); Console.WriteLine("Path: {0}", path.ToString()); Console.WriteLine(new string('-', 30)); Console.WriteLine("Total points in path: {0}", path.Count); path.Clear(); Console.WriteLine(new string('-', 30)); Console.WriteLine("Clearing path."); Console.WriteLine(new string('-', 30)); Console.WriteLine("Total points in path: {0}", path.Count); path.AddPoint(firstPoint); path.AddPoint(zeroPoint); PathStorage.SavePath(path, "input"); Console.WriteLine(new string('-', 30)); Console.WriteLine("Saving path in a text file."); PathStorage.LoadPath("input"); Console.WriteLine(new string('-', 30)); Console.WriteLine("Loading path from a text file."); }