Add wrap (#2522)
* add wrap function * fixed Wrap function wrapping wrong
This commit is contained in:
parent
377dcef9f4
commit
c392f0c16b
1 changed files with 9 additions and 1 deletions
|
@ -158,7 +158,7 @@ typedef struct float16 {
|
|||
float v[16];
|
||||
} float16;
|
||||
|
||||
#include <math.h> // Required for: sinf(), cosf(), tan(), atan2f(), sqrtf(), fminf(), fmaxf(), fabs()
|
||||
#include <math.h> // Required for: sinf(), cosf(), tan(), atan2f(), sqrtf(), floor(), fminf(), fmaxf(), fabs()
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Utils math
|
||||
|
@ -198,6 +198,14 @@ RMAPI float Remap(float value, float inputStart, float inputEnd, float outputSta
|
|||
return result;
|
||||
}
|
||||
|
||||
// Wrap input value from min to max
|
||||
RMAPI float Wrap(float value, float min, float max)
|
||||
{
|
||||
float result = value - (max - min)*floor((value - min)/(max - min));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check whether two given floats are almost equal
|
||||
RMAPI int FloatEquals(float x, float y)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue