diff options
| author | raysan5 <raysan5@gmail.com> | 2016-01-25 11:12:31 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-01-25 11:12:31 +0100 |
| commit | 3113a20390a1e4d81e9f832e7aa1d022afdb56d1 (patch) | |
| tree | adc2f2e480a0278e311fbd95e73cb3c6482657fb /src/raymath.h | |
| parent | 41959eeae10d7d01fbd2abc19ccae4fc65aae031 (diff) | |
| download | raylib-3113a20390a1e4d81e9f832e7aa1d022afdb56d1.tar.gz raylib-3113a20390a1e4d81e9f832e7aa1d022afdb56d1.zip | |
Added bounding box calculation
Diffstat (limited to 'src/raymath.h')
| -rw-r--r-- | src/raymath.h | 26 |
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 //---------------------------------------------------------------------------------- |
