You've already forked godot
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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user