Beispiel #1
0
        static double GetDistance(pointStruct A, pointStruct B)
        {
            int width  = Math.Abs(A.x) - Math.Abs(B.x);
            int height = Math.Abs(A.y) - Math.Abs(B.y);
            int depth  = Math.Abs(A.z) - Math.Abs(B.z);

            return(Math.Sqrt(width * width + height * height + depth * depth));
        }
Beispiel #2
0
        static pointStruct[] GetPoints(int n = 5)
        {
            pointStruct[] points = new pointStruct[n];

            for (int i = 0; i < n; i++)
            {
                points[i] = new pointStruct
                {
                    x = random.Next(1, 100),
                    y = random.Next(1, 100),
                    z = random.Next(1, 100)
                };
            }

            return(points);
        }
 static double Get3Distance(pointStruct pointA, pointStruct pointB) => (double)Math.Sqrt(Math.Pow(pointA.x - pointB.x, 2) + Math.Pow(pointA.y - pointB.y, 2) + Math.Pow(pointA.z - pointB.z, 2));