示例#1
0
        static void Main()
        {
            Point3D point1 = new Point3D(2, 4, 3);
            Point3D point2 = new Point3D(2, 4, 7);
            Point3D point3 = new Point3D(1, 7, 4);
            Point3D point4 = new Point3D(3, 6, 9);
            Point3D point5 = new Point3D(2, 8, 7);

            Path testPath = new Path();

            testPath.AddPoint(point1);
            testPath.AddPoint(point2);
            testPath.AddPoint(point3);
            testPath.AddPoint(point4);
            testPath.AddPoint(point5);

            PathStorage.SavePath(testPath, "test");


            Path loadedPath = PathStorage.LoadPath(@"../../test.txt");

            for (int i = 0; i < loadedPath.Sequence.Count; i++)
            {
                Console.WriteLine(loadedPath.Sequence[i]);
            }
        }
示例#2
0
        public static void Main()
        {
            // Adding some paths to save in file
            Point3D path    = new Point3D(1, 4, 7);
            Path    current = new Path();

            current.AddPath(path);

            path = new Point3D(1, 74, 78);
            current.AddPath(path);

            path = new Point3D(18, 14, 8);
            current.AddPath(path);

            path = new Point3D(100, 84, 47);
            current.AddPath(path);

            path = new Point3D(47, 94, 0);
            current.AddPath(path);

            PathStorage.SavePath(current);

            Console.WriteLine("The paths are saved in PathSave.txt");

            // Uncomment the foreach cycle in PathStorage.cs to print the path readed from PathLoad.txt
            PathStorage.LoadPath();
        }
示例#3
0
        static void Main(string[] args)
        {
            StructPoint3D point = new StructPoint3D();

            {
                point.X = 4.3;
                point.Y = 6.2;
                point.Z = 2.1;
            }

            Console.WriteLine(point.ToString());
            double dist = Distance.CalculateDistance(point, StructPoint3D.ZeroPoint);

            Console.WriteLine(dist);

            List <StructPoint3D> p = PathStorage.LoadPath();

            foreach (var item in p)
            {
                Console.WriteLine(item);
            }

            Console.WriteLine();
            p.Add(point);
            PathStorage.SavePath(p);

            foreach (var item in p)
            {
                Console.WriteLine(item);
            }
        }
示例#4
0
        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Console.WriteLine("Start point coordinates: ({0})\n", Point3D.StartPoint);

            Point3D secondPoint = new Point3D(50.05, 50, 5.555);

            Console.WriteLine("Second point coordinates: ({0})\n", secondPoint);
            Console.WriteLine("The distance between start and second point: {0:F2}\n",
                              DistanceCalculator.CalculateDistance(secondPoint, Point3D.StartPoint));

            Path path = new Path();

            path.AddPath(Point3D.StartPoint);          // Adding paths
            path.AddPath(secondPoint);
            path.AddPath(new Point3D(-2, 22, 0.22));
            Console.WriteLine(path);

            Console.WriteLine("Writing the upper coordinates to 'test.txt' file\n");
            PathStorage.SavePath(path, @"..\..\test.txt");

            Console.WriteLine("Read 'test.txt' file:");
            Path testRead = PathStorage.LoadPath(@"..\..\test.txt");

            Console.WriteLine(testRead);
        }
示例#5
0
        static void Main()
        {
            Path filePath = PathStorage.LoadPath("../../Testpaths.txt");

            for (int i = 0; i < filePath.Sequence.Count; i++)
            {
                Console.WriteLine(filePath.Sequence[i]);
            }
        }
示例#6
0
        static void Main()
        {
            Path p = new Path(1, 2, 3);
            Path d = new Path(3, 4, 4);
            Path c = new Path(5, 6, 7);

            PathStorage.LoadPath(p.ToString()); //Save path in file savedPaths.txt
            string pathBuffer = "savePaths.txt";
            //Path final = PathStorage.LoadPath(pathBuffer); //loading from the file savedPaths.txt
        }
        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
        }
示例#8
0
        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());
            }
        }