Exemple #1
0
        public static double CalculateVector(ThreeDPoint first, ThreeDPoint second)
        {
            if (second.xCord > first.xCord)
            {
                int temp = first.xCord;
                first.xCord  = second.xCord;
                second.xCord = temp;
            }
            int width = first.xCord - second.xCord;

            if (second.yCord > first.yCord)
            {
                int temp = first.yCord;
                first.yCord  = second.yCord;
                second.yCord = temp;
            }
            int height = first.yCord - second.yCord;

            if (second.zCord > first.zCord)
            {
                int temp = first.zCord;
                first.zCord  = second.zCord;
                second.zCord = temp;
            }
            int    depth  = first.zCord - second.zCord;
            double result = Math.Sqrt(Math.Pow(width, 2) + Math.Pow(height, 2) + Math.Pow(depth, 2));

            return(result);
        }
Exemple #2
0
        public static void ThreeDemension()
        {
            ThreeDPoint[] Points = new ThreeDPoint[1000];
            Random        rdn    = new Random();

            //Parallel.For(0, Points.Length - 1, i => Points[i] = new ThreeDPoint(rdn.Next(1, 1001), rdn.Next(1, 1001), rdn.Next(1, 1001)));

            for (int i = 0; i < Points.Length; i++)
            {
                Points[i] = new ThreeDPoint(rdn.Next(1, 1001), rdn.Next(1, 1001), rdn.Next(1, 1001));
            }
            Util.CompareVector(Points);
        }