static void Main()
        {
            Point3D point = new Point3D(1, 2, 3);

            Console.WriteLine(point);
            Console.WriteLine(Point3D.Origin);

            var dist = Point3DExtensions.CalculateDistance(point, Point3D.Origin);
            Console.WriteLine(dist);

            var path = new Path();
            for (int i = 0; i < 10; i++)
            {
                path.AddPoint(new Point3D() { X = i, Y = i * 2, Z = i + 3 });
            }

            string pathStr = "../../path.txt";
            PathStorage.SavePath(path, pathStr);
            var pathFromFile = PathStorage.LoadPath(pathStr);

            foreach (var p in pathFromFile)
            {
                Console.WriteLine(p);
            }
        }
Example #2
0
        public static void Main()
        {
            Point3D firstPoint = new Point3D(1.1, 2.2, 3.3);
            Point3D secondPoint = new Point3D(3.3, 2.2, 1.1);

            double dist = DistanceCalculator.CalculateDistanceBetweenTwoPoints(firstPoint, secondPoint);
            Console.WriteLine("The distance between points ({0}) and ({1}) is {2:F2}.", firstPoint, secondPoint, dist);

            Path firstPath = new Path();
            firstPath.AddPointToPath(firstPoint);
            firstPath.AddPointToPath(secondPoint);
            Console.WriteLine(firstPath);

            PathStorage.SavePathToFile(firstPath, "FirstPath.txt");

            Path secondPath = PathStorage.LoadPathFromFile("Points.txt");
            Console.WriteLine(secondPath);

            PathStorage.SavePathToFile(secondPath, "NewPoints.txt");
        }
        public static void Main()
        {
            Point3D firstPoint = new Point3D(12.3, 4.7, 7.12);
            Console.WriteLine(firstPoint.ToString());
            Console.WriteLine(new string('=', 30));
            Point3D secondPoint = new Point3D(7.12, 12.3, 4.7);
            Console.WriteLine(secondPoint.ToString());
            Console.WriteLine(new string('=', 30));
            Console.WriteLine(DistanceCalc.Distance(firstPoint, secondPoint));
            Console.WriteLine(new string('=', 30));

            Path anyPath = new Path();
            anyPath.AddPoint(firstPoint);
            anyPath.AddPoint(secondPoint);

            PathStorage.SavePath(anyPath);

            Path loadedPath = new Path();
            PathStorage.LoadPath(loadedPath);
            for (int i = 0; i < loadedPath.ListOfPoints.Count; i++)
            {
                Console.WriteLine(loadedPath.ListOfPoints[i].ToString());
            }
        }