Ejemplo n.º 1
0
    static void Main()
    {
        //Point3D Test
        Point3D pointA        = new Point3D(5, 5, 5);
        var     startingPoint = Point3D.StartingPoint;

        Console.WriteLine("Starting {0}", startingPoint);
        Console.WriteLine("Current {0}", pointA);

        Console.WriteLine();

        //Distance Calculator Test
        var pointB = new Point3D(2, 2, 2);

        Console.WriteLine("The distance between {0} and {1} = {2:F4}",
                          pointA, pointB, DistanceCalculator.CalculateTheDistance(pointA, pointB));
        Console.WriteLine();

        //Paths3D Test
        var pointC = new Point3D(1, 3, 1);
        var points = new List <Point3D>()
        {
            pointA, pointB, pointC
        };
        var path = new Paths3D(points);

        Console.WriteLine(path);
    }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Point3D start          = Point3D.StartingCoords;
            Point3D a              = new Point3D(1, 1, 1);
            Point3D b              = new Point3D(2, 2, 3);
            double  distanceStartA = DistanceCalculator.CalculateTheDistance(start, a);
            double  distanceStartB = DistanceCalculator.CalculateTheDistance(start, b);
            Path3D  first          = new Path3D(start, a);
            Path3D  second         = new Path3D(start, a, b);

            Storage.SavePath(first, "pathFirst.txt");
            Storage.SavePath(second, "pathSecond.txt");

            try
            {
                Path3D loadedFirst = Storage.LoadPath("pathFirst.txt");
                foreach (Point3D point in loadedFirst.Points)
                {
                    Console.WriteLine("{0} {1} {2}", point.X, point.Y, point.Z);
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine(e.Message);
            }
        }