CCT.NUI.WPFSamples.KinectTouchWindow.Scale C# (CSharp) Method

Scale() private static method

private static Scale ( int maxPixel, float maxSkeleton, float position ) : float
maxPixel int
maxSkeleton float
position float
return float
        private static float Scale(int maxPixel, float maxSkeleton, float position)
        {
            float value = (((((float)maxPixel) / maxSkeleton) / 2f) * position) + (maxPixel / 2);
            if (value > maxPixel)
            {
                return (float)maxPixel;
            }
            if (value < 0f)
            {
                return 0f;
            }
            return value;
        }