Esempio n. 1
0
        static void Main()
        {
            Path pointsPath = new Path();
            pointsPath.AddPoint(new Point3D(10, 10, 10));
            pointsPath.AddPoint(new Point3D(0.5, 0.3, 0.4));
            pointsPath.AddPoint(new Point3D(0.7, 0.24, 5.73));

            Console.WriteLine("Current points: ");
            Console.WriteLine(pointsPath.ToString());

            // Save the points to the file
            PathStorage.Save(pointsPath, "Test.txt");

            // Read the new points
            Path newPointsPath = PathStorage.Load("Test.txt");
            Console.WriteLine("Points read from the file: ");
            Console.WriteLine(newPointsPath.ToString());
        }
Esempio n. 2
0
        static void Main()
        {
            Point3D point3D = new Point3D(1, 2, 3);
            Point3D anotherPoint3D = new Point3D(3, 2, 1);
            Console.WriteLine(point3D);
            Console.WriteLine(Point3D.ZeroCoord);

            Console.WriteLine(Distance.Points3D(point3D, Point3D.ZeroCoord));
            Console.WriteLine(Distance.Points3D(point3D, anotherPoint3D));

            Path firstPath = new Path();
            firstPath = PathStorage.LoadPath();
            Console.WriteLine("-----print path-----");
            firstPath.PrintPath();
            Console.WriteLine("-----end-----");

            PathStorage.SavePath(firstPath);
        }
        public static void CreatePoint()
        {
            Console.WriteLine("Examplary points");
            Point3D pointInput1 = new Point3D(-7, -4, 3);
            Point3D pointInput2 = new Point3D(17, 6, 2.5);
            Console.WriteLine("Point A:");
            Console.WriteLine(pointInput1);
            Console.WriteLine("Point B:");
            Console.WriteLine(pointInput2);
            double distance = DistanceCalculation.Distance(pointInput1, pointInput2);
            Console.WriteLine("The distance between point A and point B is:");
            Console.WriteLine(distance);
            string filePath = "../../Paths.txt";

            List<Path> listOfPaths = new List<Path>();
            while (true)
            {
                Console.WriteLine("Do you want to create a new path:");
                string input = Console.ReadLine();
                if (input == "Yes")
                {
                    Path newPath = new Path();
                    newPath.PointsCollection = newPath.AddPath();
                    listOfPaths.Add(newPath);

                    PathStorage.SavePath(filePath, listOfPaths);
                }
                else
                {
                    break;
                }
            }

            Console.WriteLine("The text files paths.txt is in the folder called \"Structure\".");

            // The paths from the text file are here:
            List<Path> listOfRecordedPaths = PathStorage.LoadPath(filePath);
        }