Beispiel #1
0
        static void Main(string[] args)
        {
            var pointA = new Point3D(20.5, 12.8, 6);
            var pointB = new Point3D(-4, 5.5, 50);

            Console.WriteLine($"{DistanceCalculator.CalculateDistance(pointA, pointB):F8}");
        }
Beispiel #2
0
 public static double CalculateDistance(Point3D pointA, Point3D pointB)
 {
     return Math.Sqrt(
         Math.Pow(pointB.AxisX - pointA.AxisX, 2) +
         Math.Pow(pointB.AxisY - pointA.AxisY, 2) +
         Math.Pow(pointB.AxisZ - pointA.AxisZ, 2));
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            Point3D firstP = new Point3D(0, 0, 0);
            Point3D secondP = new Point3D(1, 2, 3);

            Console.WriteLine("The distance between {0} and {1} is {2}",firstP, secondP, DistanceCalculator.Calculate(firstP,secondP));
        }
 public static double CalculateDistance(Point3D first, Point3D second)
 {
     double result = Math.Sqrt(
       (second.X - first.X) * (second.X - first.X) +
       (second.Y - first.Y) * (second.Y - first.Y) +
       (second.Z - first.Z) * (second.Z - first.Z));
     return result;
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Start points:" + Point3D.Start);

            Point3D firstPoint = new Point3D(2, 4, 1);

            Console.WriteLine("Current points:" + firstPoint);
        }
        static void Main(string[] args)
        {
            Point3D point1 = new Point3D(-7, -4, 3);
            Point3D point2 = new Point3D(17, 6, 2.5);

            Console.WriteLine(DistanceCalculator.CalcDistance(point1, point2));
            
        }
        public static double CalcDistance(Point3D point1, Point3D point2) 
        {
            double distance = 0;

            distance = Math.Sqrt((point2.X - point1.X) * (point2.X - point1.X) + (point2.Y - point1.Y) * (point2.Y - point1.Y)
                + (point2.Z - point1.Z) * (point2.Z - point1.Z));

            return distance;
        }
Beispiel #8
0
 static void Main()
 {
     Point3D point1 = new Point3D(1, 3, 5);
     Point3D point2 = new Point3D(-4, 4.5, -7);
     Point3D point3 = new Point3D(1.2, 10, 12);
     Path3D path = new Path3D(Path3D.CreateSequenceOfPoints(point1, point2, point3));
     string text = path.ToString();
     Storage.SaveToFile(".../.../file.txt",text);
     Storage.LoadFile(".../.../file.txt");            
 }
 static void Main()
 {
     Point3D pointA = new Point3D("pointA", 1.2, 3, 5.6);
     Point3D pointB = new Point3D("pointB", -1.2, 3, 5.6);
     Point3D pointc = new Point3D("pointC", 0, 2, 3);
     //Point3D pointTest = new Point3D();
     Console.WriteLine(pointA.ToString());
     Console.WriteLine(pointB.ToString());
     Console.WriteLine(pointc.ToString());
     Console.WriteLine(DistanceCalculator.GetDistance(pointA, pointB));
 }
        static void Main()
        {
            Point3D pointA = new Point3D();
            Point3D pointB = new Point3D(1, 1, 1);
            double distance = 0;
            Console.WriteLine(pointB);
            Console.WriteLine(Point3D.pointZero);

            distance = DistanceBetweenTwoPoints.CalculateDistance(pointA, pointB);
            Console.WriteLine("The distance between two points is: " + distance);
        }
 public static List<Point3D> Load()
 {
     using (StreamReader reader = new StreamReader("../../loadPath.txt"))
     {
         string line = reader.ReadLine();
         List<Point3D> loadPath = new List<Point3D>();
         while(line != null)
         {
             string[] splitLine = line.Split(new char[] {' ', ','}, StringSplitOptions.RemoveEmptyEntries);
             int xCoord = int.Parse(splitLine[0]);
             int yCoord = int.Parse(splitLine[1]);
             int zCoord = int.Parse(splitLine[2]);
             Point3D point = new Point3D(xCoord, yCoord, zCoord);
             loadPath.Add(point);
             line = reader.ReadLine();
         }
         return loadPath;
     }
 }
 public static double GetDistance(Point3D a, Point3D b)
 {
     double distance = 0; 
     distance= Math.Sqrt(((a.X-b.X) * (a.X-b.X))+ ((a.Y-b.Y) * (a.Y-b.Y))+ ((a.Z-b.Z) * (a.Z-b.Z)));
     return distance;
 }
 static void Main(string[] args)
 {
     Point3D point1 = new Point3D(1, 4, 1);
     Point3D point2 = new Point3D(-4, 10, 2);
     Console.WriteLine(DistanceCalc.CalculateDistance(point1, point2));
 }
Beispiel #14
0
 static void Main(string[] args)
 {
     Point3D test = new Point3D(0, 1, 2);
     Console.WriteLine(test.ToString()); // but the output will be the same without using ".ToString()"
 }
Beispiel #15
0
 public void AddPoint(Point3D point)
 {
     this.path.Add(point);
 }
 private static void Main()
 {
     Point3D a = new Point3D(1, 2, 3);
     Console.WriteLine(a);
     Console.WriteLine(Point3D.StartingPoint());
 }
 static Point3D()
 {
     startingPoint = new Point3D("center", 0);
 }
Beispiel #18
0
 static void Main(string[] args)
 {
     var point = new Point3D(20, 8.5, 11);
     Console.WriteLine(point);
     Console.WriteLine(Point3D.StartingPoint);
 }
Beispiel #19
0
 public static void Main()
 {
     Point3D point = new Point3D(3,3,5);
     double distance = Distance.CalculateDistance(Point3D.Zero, point );
     Console.WriteLine(distance);
 }
Beispiel #20
0
 public void AddPoint(Point3D point)
 {
     route.Add(point);
 }
 public static double Calculate(Point3D point1, Point3D point2)
 {
     return Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) +
         (point1.Y - point2.Y) * (point1.Y - point2.Y) +
         (point1.Z - point2.Z) * (point1.Z - point2.Z));
 }
 public static double CalculateDistance(Point3D point1, Point3D point2)
 {
     double result = 0;
     result = Math.Sqrt((point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y)*(point1.y - point2.y) + (point1.z - point2.z)*(point1.z - point2.z));
     return result;
 }
Beispiel #23
0
 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));
 }
Beispiel #24
0
 public void AddPoint3D(Point3D point3D)
 {
     this.points3D.Add(point3D);
 }
Beispiel #25
0
 static void Main()
 {
     Point3D point = new Point3D(3, 5, 6);
     Console.WriteLine(point);
     Console.WriteLine(Point3D.StartingPoint);          
 }