Exemplo n.º 1
0
 public Path3D(Point3D[] points)
 {
     foreach (Point3D point in points)
     {
         AddPoint(point);
     }
 }
Exemplo n.º 2
0
 private static Point3D[] generateRandomPoints(int count)
 {
     Random R = new Random();
     Point3D[] pointArray = new Point3D[count];
     for (int i = 0; i < count; i++)
     {
         pointArray[i] = new Point3D((float)R.Next(1, 100), (float)R.Next(1, 100), (float)R.Next(1, 100));
     }
     return pointArray;
 }
Exemplo n.º 3
0
 public static void TestDistance()
 {
     float x, y, z;
     Console.WriteLine("You're about to enter the XYZ coordinates of two points:");
     Console.WriteLine("Point One");
     Console.WriteLine("Enter X:");
     x = float.Parse(Console.ReadLine());
     Console.WriteLine("Enter Y:");
     y = float.Parse(Console.ReadLine());
     Console.WriteLine("Enter Z:");
     z = float.Parse(Console.ReadLine());
     Point3D firstPoint3D = new Point3D(x, y, z);
     Console.WriteLine("Point Two");
     Console.WriteLine("Enter X:");
     x = float.Parse(Console.ReadLine());
     Console.WriteLine("Enter Y:");
     y = float.Parse(Console.ReadLine());
     Console.WriteLine("Enter Z:");
     z = float.Parse(Console.ReadLine());
     Point3D secondPoint3D = new Point3D(x, y, z);
     float result = DistanceCalculator.CalculateDistance(firstPoint3D, secondPoint3D);
     Console.WriteLine("Calculated Distance is {0}", result);
 }
Exemplo n.º 4
0
 public void AddPoint(Point3D point3D)
 {
     points.Add(point3D);
 }
Exemplo n.º 5
0
 public static float CalculateDistance(Point3D a, Point3D b)
 {
     return (float) Math.Sqrt(Math.Pow(a.X - b.X, 2) + 
                     Math.Pow(a.Y - b.Y, 2) +
                     Math.Pow(a.Z + b.Z, 2));
 }