Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Point3D one = new Point3D(1, 1, 1);
            Point3D two = new Point3D(2, 4, 8);
            Path3D firstPath = new Path3D();
            firstPath.AddPoint3D(one, two);
            Path3D secondPath = new Path3D(one, two);

            Console.WriteLine("{0:F4}", DistanceCalculator.CalculateDistanceBetweenPoints(one, two));

            Console.WriteLine(firstPath);
            Console.WriteLine(secondPath);

            Point3D temp = Point3D.StartingPoint();
        }
Exemplo n.º 2
0
        public static Path3D LoadPath(string fileName)
        {
            Path3D data = new Path3D();
            StreamReader reader = new StreamReader(fileName);

            using (reader)
            {
                string currentLine = reader.ReadLine();

                while (currentLine != null)
                {
                    string[] currentPoint = currentLine.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                    Point3D point = new Point3D(int.Parse(currentPoint[0]), int.Parse(currentPoint[1]), int.Parse(currentPoint[2]));
                    data.AddPoint3D(point);
                    currentLine = reader.ReadLine();
                }
            }

            return data;
        }