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:
parent
b897ae092a
commit
abb94bd2ff
@ -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
|
||||
//----------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user