summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRay <[email protected]>2022-04-23 23:39:50 +0200
committerRay <[email protected]>2022-04-23 23:39:50 +0200
commit015a71fc407e6cba3162b120ea20651df40e0c13 (patch)
tree6ba1e8e4fbf7a1a1217e4486150772dbca79e13c /src
parentbe3ae71aecbc9dcd984069164ccabf4df8742e5d (diff)
downloadraylib-015a71fc407e6cba3162b120ea20651df40e0c13.tar.gz
raylib-015a71fc407e6cba3162b120ea20651df40e0c13.zip
Update raymath.h
Diffstat (limited to 'src')
-rw-r--r--src/raymath.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/raymath.h b/src/raymath.h
index bb51586b..21f5cf43 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -447,8 +447,7 @@ RMAPI Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max)
return result;
}
-// Clamp the magnitude of the vector between two
-// given min and max values
+// Clamp the magnitude of the vector between two min and max values
RMAPI Vector2 Vector2ClampValue(Vector2 v, float min, float max)
{
Vector2 result = { 0 };
@@ -942,9 +941,8 @@ RMAPI Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max)
return result;
}
-// Clamp the magnitude of the vector between two
-// given min and max values
-RMAPI Vector3 Vector3ClampValue(Vector3 v, float minMag, float maxMag)
+// Clamp the magnitude of the vector between two values
+RMAPI Vector3 Vector3ClampValue(Vector3 v, float min, float max)
{
Vector3 result = { 0 };
@@ -953,16 +951,16 @@ RMAPI Vector3 Vector3ClampValue(Vector3 v, float minMag, float maxMag)
{
length = sqrtf(length);
- if (length < minMag)
+ if (length < min)
{
- float scale = minMag/length;
+ float scale = min/length;
result.x = v.x*scale;
result.y = v.y*scale;
result.z = v.z*scale;
}
- else if (length > maxMag)
+ else if (length > max)
{
- float scale = maxMag/length;
+ float scale = max/length;
result.x = v.x*scale;
result.y = v.y*scale;
result.z = v.z*scale;