1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Update wrap functions

This commit is contained in:
Chaosus
2018-03-04 19:16:57 +03:00
parent 184b2fe21b
commit 70bb31a7b2
2 changed files with 12 additions and 17 deletions

View File

@@ -177,18 +177,3 @@ float Math::random(float from, float to) {
float ret = (float)r / (float)RANDOM_MAX;
return (ret) * (to - from) + from;
}
int Math::wrapi(int value, int min, int max) {
--max;
int rng = max - min + 1;
value = ((value - min) % rng);
if (value < 0)
return max + 1 + value;
else
return min + value;
}
float Math::wrapf(float value, float min, float max) {
float rng = max - min;
return min + (value - min) - (rng * floor((value - min) / rng));
}