summaryrefslogtreecommitdiff
path: root/indra/llmath/v3math.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath/v3math.h')
-rw-r--r--indra/llmath/v3math.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h
index 73738cffd2..5d483a8753 100644
--- a/indra/llmath/v3math.h
+++ b/indra/llmath/v3math.h
@@ -40,6 +40,7 @@
class LLVector2;
class LLVector4;
class LLMatrix3;
+class LLMatrix4;
class LLVector3d;
class LLQuaternion;
@@ -115,6 +116,7 @@ class LLVector3
const LLVector3& rotVec(F32 angle, F32 x, F32 y, F32 z); // Rotates about x,y,z by angle radians
const LLVector3& rotVec(const LLMatrix3 &mat); // Rotates by LLMatrix4 mat
const LLVector3& rotVec(const LLQuaternion &q); // Rotates by LLQuaternion q
+ const LLVector3& transVec(const LLMatrix4& mat); // Transforms by LLMatrix4 mat (mat * v)
const LLVector3& scaleVec(const LLVector3& vec); // scales per component by vec
LLVector3 scaledVec(const LLVector3& vec) const; // get a copy of this vector scaled by vec
@@ -280,7 +282,7 @@ inline void LLVector3::setVec(const F32 *vec)
inline F32 LLVector3::normalize(void)
{
- F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
+ F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
F32 oomag;
if (mag > FP_MAG_THRESHOLD)
@@ -303,7 +305,7 @@ inline F32 LLVector3::normalize(void)
// deprecated
inline F32 LLVector3::normVec(void)
{
- F32 mag = fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
+ F32 mag = (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
F32 oomag;
if (mag > FP_MAG_THRESHOLD)
@@ -327,7 +329,7 @@ inline F32 LLVector3::normVec(void)
inline F32 LLVector3::length(void) const
{
- return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
+ return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
}
inline F32 LLVector3::lengthSquared(void) const
@@ -337,7 +339,7 @@ inline F32 LLVector3::lengthSquared(void) const
inline F32 LLVector3::magVec(void) const
{
- return fsqrtf(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
+ return (F32) sqrt(mV[0]*mV[0] + mV[1]*mV[1] + mV[2]*mV[2]);
}
inline F32 LLVector3::magVecSquared(void) const
@@ -471,7 +473,7 @@ inline F32 dist_vec(const LLVector3 &a, const LLVector3 &b)
F32 x = a.mV[0] - b.mV[0];
F32 y = a.mV[1] - b.mV[1];
F32 z = a.mV[2] - b.mV[2];
- return fsqrtf( x*x + y*y + z*z );
+ return (F32) sqrt( x*x + y*y + z*z );
}
inline F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b)
@@ -529,6 +531,21 @@ inline void update_min_max(LLVector3& min, LLVector3& max, const LLVector3& pos)
}
}
+inline void update_min_max(LLVector3& min, LLVector3& max, const F32* pos)
+{
+ for (U32 i = 0; i < 3; i++)
+ {
+ if (min.mV[i] > pos[i])
+ {
+ min.mV[i] = pos[i];
+ }
+ if (max.mV[i] < pos[i])
+ {
+ max.mV[i] = pos[i];
+ }
+ }
+}
+
inline F32 angle_between(const LLVector3& a, const LLVector3& b)
{
LLVector3 an = a;