Beispiel #1
0
        static void Main()
        {
            // Task 1
            Point3D pointOne = new Point3D(1, 1, 3);
            Point3D pointTwo = new Point3D(3, 4, 6);
            Console.WriteLine(pointOne);
            Console.WriteLine(pointTwo);

            // Task 2
            Point3D pointThree = Point3D.PointO;
            Console.WriteLine(pointThree);

            // Task 3
            Console.WriteLine(Distance3D.GetDistance(pointOne, pointTwo));

            // Task 4.1
            Path pathOne = new Path(pointOne, pointTwo, pointThree);
            Path pathTwo = new Path(pointThree, pointTwo, pointOne);
            List<Path> paths = new List<Path>();
            paths.Add(pathOne);
            paths.Add(pathTwo);

            // Task 4.2
            PathStorage.SavePath("../../Paths.txt", paths);
            paths.Clear();
            PathStorage.LoadPath("../../Paths.txt", paths);
        }
Beispiel #2
0
        public static double GetDistance(Point3D p1, Point3D p2)
        {
            int deltaX = p1.X - p2.X;
            int deltaY = p1.Y - p2.Y;
            int deltaZ = p1.Z - p2.Z;

            return Math.Sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ);
        }
 public static double Distance3D(Point3D p1, Point3D p2)
 {
     return Math.Sqrt(Math.Pow(p2.X - p1.X, 2) +
                      Math.Pow(p2.Y - p1.Y, 2) +
                      Math.Pow(p2.Z - p1.Z, 2));
 }
 public static void AddPoint(Point3D p)
 {
     points.Add(p);
 }
Beispiel #5
0
 public void AddPoint(Point3D point)
 {
     points.Add(point);
 }
        // METHODS

        /// <summary>
        /// Adds a point to the invoking path.
        /// </summary>
        /// <param name="p"></param>
        public void AddPoint(Point3D p)
        {
            sequence.Add(p);
        }