static double CalculateDistance(Point3D firstPoint, Point3D secondPoint)
        {
            int x = firstPoint.X - secondPoint.X;
            int y = firstPoint.Y - secondPoint.Y;
            int z = firstPoint.Z - secondPoint.Z;

            return Math.Sqrt((x * x) + (y * y) + (z * z));
        }
示例#2
0
 public static Path LoadPath()
 {
     Path loadPath = new Path();
     Point3D point = new Point3D();
     using (StreamReader fileLoad = new StreamReader(@"../../Files/LoadPath.txt"))
     {
         string line = "";
         while ((line = fileLoad.ReadLine()) != null)
         {
             string[] points = line.Split(',', ' ');
             point.X = int.Parse(points[0]);
             point.Y = int.Parse(points[1]);
             point.Z = int.Parse(points[2]);
             loadPath.AddPoint(point);
         }
     }
     return loadPath;
 }
示例#3
0
        static void Main()
        {
            Console.WriteLine(Point3D.pointCount);
            Point3D point1 = new Point3D();
            Console.WriteLine(point1);
            point1.X = 1;
            point1.Y = 1;
            point1.Z = 1;
            Point3D point2 = new Point3D(1, 7, 4);
            Point3D point3 = new Point3D();
            point3 = new Point3D(1, 1, 1);
            Console.WriteLine();
            //CalculateSpace(point1, point2);
            Console.WriteLine(Point3D.StartPoint);

            Point3D point4 = new Point3D(2, 4, 4);
            Console.WriteLine(Point3D.pointCount);

            Console.WriteLine( Distance3D.CalculateDistance(point1, point2));
            Path path = new Path();
            path.AddPoint(point1);
            path.AddPoint(point2);
            foreach (Point3D point in path)
            {
                Console.WriteLine(point);
                Console.WriteLine();
            }
            PathStorage.SavePath(path);
            Console.WriteLine("loaded paths");
            Path loadPath = PathStorage.LoadPath();
            foreach (Point3D point in loadPath)
            {
                Console.WriteLine(point);
                Console.WriteLine();
            }
        }
示例#4
0
 //method
 public static double CalculateDistance(Point3D point1, Point3D point2)
 {
     return Math.Sqrt(Math.Pow((point1.X - point2.X), 2) + Math.Pow((point1.Y - point2.Y), 2) + Math.Pow((point1.Z - point2.Z), 2));
 }
示例#5
0
 public void AddPoint(Point3D point)
 {
     pathHolder.Add(point);
 }