mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-07 11:58:13 +00:00
add wrap function (#2521)
This commit is contained in:
@@ -158,7 +158,7 @@ typedef struct float16 {
|
|||||||
float v[16];
|
float v[16];
|
||||||
} float16;
|
} float16;
|
||||||
|
|
||||||
#include <math.h> // Required for: sinf(), cosf(), tan(), atan2f(), sqrtf(), fminf(), fmaxf(), fabs()
|
#include <math.h> // Required for: sinf(), cosf(), tan(), atan2f(), sqrtf(), fmodf(), fminf(), fmaxf(), fabs()
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition - Utils math
|
// Module Functions Definition - Utils math
|
||||||
@@ -198,6 +198,14 @@ RMAPI float Remap(float value, float inputStart, float inputEnd, float outputSta
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrap input value from min to max
|
||||||
|
RMAPI float Wrap(float value, float min, float max)
|
||||||
|
{
|
||||||
|
float result = min + fmodf(value - min, max - min);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether two given floats are almost equal
|
// Check whether two given floats are almost equal
|
||||||
RMAPI int FloatEquals(float x, float y)
|
RMAPI int FloatEquals(float x, float y)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user