Пример #1
0
        private float DistanceSquare(ComputeBuffer a, ComputeBuffer b)
        {
            var viewA = a.ViewAs <float>();
            var viewB = b.ViewAs <float>();

            float d = 0;

            for (int i = 0; i < viewA.Lenght; i++)
            {
                var sub = viewA[i] - viewB[i];
                d += sub * sub;
            }

            return(d);
        }