aboutsummaryrefslogtreecommitdiff
path: root/src/raymath.h
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-01-25 11:12:31 +0100
committerraysan5 <raysan5@gmail.com>2016-01-25 11:12:31 +0100
commit3113a20390a1e4d81e9f832e7aa1d022afdb56d1 (patch)
treeadc2f2e480a0278e311fbd95e73cb3c6482657fb /src/raymath.h
parent41959eeae10d7d01fbd2abc19ccae4fc65aae031 (diff)
downloadraylib-3113a20390a1e4d81e9f832e7aa1d022afdb56d1.tar.gz
raylib-3113a20390a1e4d81e9f832e7aa1d022afdb56d1.zip
Added bounding box calculation
Diffstat (limited to 'src/raymath.h')
-rw-r--r--src/raymath.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/raymath.h b/src/raymath.h
index f5448504..46fab356 100644
--- a/src/raymath.h
+++ b/src/raymath.h
@@ -126,6 +126,8 @@ RMDEF Vector3 VectorLerp(Vector3 v1, Vector3 v2, float amount); // Calculate lin
RMDEF Vector3 VectorReflect(Vector3 vector, Vector3 normal); // Calculate reflected vector to normal
RMDEF void VectorTransform(Vector3 *v, Matrix mat); // Transforms a Vector3 by a given Matrix
RMDEF Vector3 VectorZero(void); // Return a Vector3 init to zero
+RMDEF Vector3 VectorMin(Vector3 vec1, Vector3 vec2); // Return min value for each pair of components
+RMDEF Vector3 VectorMax(Vector3 vec1, Vector3 vec2); // Return max value for each pair of components
//------------------------------------------------------------------------------------
// Functions Declaration to work with Matrix
@@ -361,6 +363,30 @@ RMDEF Vector3 VectorZero(void)
return zero;
}
+// Return min value for each pair of components
+RMDEF Vector3 VectorMin(Vector3 vec1, Vector3 vec2)
+{
+ Vector3 result;
+
+ result.x = fminf(vec1.x, vec2.x);
+ result.y = fminf(vec1.y, vec2.y);
+ result.z = fminf(vec1.z, vec2.z);
+
+ return result;
+}
+
+// Return max value for each pair of components
+RMDEF Vector3 VectorMax(Vector3 vec1, Vector3 vec2)
+{
+ Vector3 result;
+
+ result.x = fmaxf(vec1.x, vec2.x);
+ result.y = fmaxf(vec1.y, vec2.y);
+ result.z = fmaxf(vec1.z, vec2.z);
+
+ return result;
+}
+
//----------------------------------------------------------------------------------
// Module Functions Definition - Matrix math
//----------------------------------------------------------------------------------