Adding Normalize and Remap functions (#1247)

* Adding Norm and Remap functions

// Normalize input value within input range
// Remap input value within input range to output range

* Rename Norm to Normalize

To make it uniforms with Raylib's functions

* Calculate Remap without other functions
This commit is contained in:
Noor Wachid 2020-05-15 18:08:28 +07:00 committed by GitHub
parent b897ae092a
commit abb94bd2ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,6 +154,18 @@ RMDEF float Lerp(float start, float end, float amount)
return start + amount*(end - start);
}
// Normalize input value within input range
RMDEF float Normalize(float value, float start, float end)
{
return (value - start) / (end - start);
}
// Remap input value within input range to output range
RMDEF float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd)
{
return (value - inputStart) / (inputEnd - inputStart) * (outputEnd - outputStart) + outputStart;
}
//----------------------------------------------------------------------------------
// Module Functions Definition - Vector2 math
//----------------------------------------------------------------------------------