Beispiel #1
0
        public float distanceSquared(IPointMath3D to)
        {
            double Xr = to.x - x;
            double Yr = to.y - y;
            double Zr = to.z - z;

            return((float)(Xr * Xr + Yr * Yr + Zr * Zr));
        }
        public IPointMath3D getMean()
        {
            uint R = 0, G = 0, B = 0, count = 0;

            // TODO: parallel with atomic add

            Color[][] mat = cache;

            foreach (Color[] row in mat)
            {
                foreach (Color pixel in row)
                {
                    R += pixel.R;
                    G += pixel.G;
                    B += pixel.B;
                    ++count;
                }
            }

            return(cachedMean = new PointMath3D(R / (float)count, G / (float)count, B / (float)count));
        }