Example #1
0
        static void Main()
        {
            Point3D firstPoint = new Point3D(5, 8, -4);
            Point3D secondPoint = new Point3D(1, 1, 3);

            //Test method ToString and method CalculateDistance
            Console.WriteLine("Distance between {0} and {1} is: {2:0.00}", firstPoint, secondPoint, Distance.CalculateDistance(firstPoint, secondPoint));

            //Test (0,0,0)
            Console.WriteLine(Point3D.ZeroPoint);
            Console.WriteLine();

            //Test method SavePath
            Path testPath = new Path();
            testPath.AddPoint(firstPoint);
            testPath.AddPoint(secondPoint);
            PathStorage.SavePath(testPath);

            //Test method LoadPath and print result
            List<Path> testList = PathStorage.LoadPath();
            foreach (var path in testList)
            {
                foreach (var point in path.Points)
                {
                    Console.WriteLine(point);
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            //testing distance between two points
            Point3D p1 = new Point3D(10, 20, 30);
            Point3D p2 = new Point3D(); // (0,0,0) inline initialization

            double distance = PointsDistance.CalculateDistance(p1, p2);
            Console.WriteLine("Distance: {0:F2}",distance);
            Console.WriteLine(separator);

            //testing adding points to path
            Path path = new Path();
            path.AddPoint(p1);
            path.AddPoint(p2);
            path.AddPoint(Point3D.StartOfCoordSystem);
            path.AddPoint(new Point3D(5, 6, 7));
            foreach (Point3D point in path.Sequence)
            {
                Console.WriteLine(point);
            }
            Console.WriteLine(separator);

            //saving path test
            PathStorage.SavePath(path);

            Console.WriteLine(separator);

            //loading path from file test
            List<Path> list = PathStorage.LoadPaths("paths.txt");
            for (int i = 0; i < list.Count; i++)
            {
                foreach (Point3D point in list[i].Sequence)
                {
                    Console.WriteLine(point);
                }
            }
        }
Example #3
0
        static void Main()
        {
            Point3D p1 = new Point3D(1, 2, 3);
            Point3D p2 = new Point3D(4, 5, 6);

            Console.WriteLine("1: " + p1);
            Console.WriteLine("2: " + p2);
            Console.WriteLine("Distance: " + Distance.CalcDistance(p1, p2));

            Console.WriteLine("Zero Point:");
            Console.WriteLine(Point3D.zero);

            Path pathSequence = new Path();
            pathSequence.AddPoint(p2);
            pathSequence.AddPoint(p1);
            pathSequence.AddPoint(p2);

            PathStorage.SavePath(pathSequence);
            List<Path> pathList = PathStorage.LoadPath();
            foreach (var path in pathList)
            {
                Console.WriteLine("-----Path Start-------");
                foreach (var p in path.Sequence)
                {
                    Console.WriteLine(p);
                }
                Console.WriteLine("-----Path End-------");

            }

            Console.WriteLine("Path Sequence: ");
            foreach (var item in pathSequence.sequence)
            {
                Console.WriteLine(item);
            }
        }