FairyGUI.Utils.ToolSet.uvLerp C# (CSharp) Method

uvLerp() public static method

public static uvLerp ( Vector2 uvSrc, Vector2 uvDest, float min, float max ) : void
uvSrc Vector2
uvDest Vector2
min float
max float
return void
        public static void uvLerp(Vector2[] uvSrc, Vector2[] uvDest, float min, float max)
        {
            float uMin = float.MaxValue;
            float uMax = float.MinValue;
            float vMin = float.MaxValue;
            float vMax = float.MinValue;
            int len = uvSrc.Length;
            for (int i = 0; i < len; i++)
            {
                Vector2 v = uvSrc[i];
                if (v.x < uMin)
                    uMin = v.x;
                if (v.x > uMax)
                    uMax = v.x;
                if (v.y < vMin)
                    vMin = v.y;
                if (v.y > vMax)
                    vMax = v.y;
            }
            float uLen = uMax - uMin;
            float vLen = vMax - vMin;
            for (int i = 0; i < len; i++)
            {
                Vector2 v = uvSrc[i];
                v.x = (v.x - uMin) / uLen;
                v.y = (v.y - vMin) / vLen;
                uvDest[i] = v;
            }
        }