diff options
| author | Pijus <[email protected]> | 2022-06-14 20:12:37 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-14 19:12:37 +0200 |
| commit | 81157e4e72613b09cfde8aee925cd297d8b6cce6 (patch) | |
| tree | afba72349408e96ce22c78a47c701e1c40db002f /src/raymath.h | |
| parent | d37a63fad7ea921440b74a5e18239f683d6cae35 (diff) | |
| download | raylib-81157e4e72613b09cfde8aee925cd297d8b6cce6.tar.gz raylib-81157e4e72613b09cfde8aee925cd297d8b6cce6.zip | |
add wrap function (#2521)
Diffstat (limited to 'src/raymath.h')
| -rw-r--r-- | src/raymath.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/raymath.h b/src/raymath.h index abe43545..35cd5e86 100644 --- a/src/raymath.h +++ b/src/raymath.h @@ -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(), fmodf(), 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 = min + fmodf(value - min, max - min); + + return result; +} + // Check whether two given floats are almost equal RMAPI int FloatEquals(float x, float y) { |
