summaryrefslogtreecommitdiff
path: root/indra/llmath/llcoordframe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath/llcoordframe.cpp')
-rw-r--r--indra/llmath/llcoordframe.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp
index b42541c7c0..15c9f6ff3f 100644
--- a/indra/llmath/llcoordframe.cpp
+++ b/indra/llmath/llcoordframe.cpp
@@ -328,30 +328,28 @@ void LLCoordFrame::rotate(const LLMatrix3 &rotation_matrix)
}
-// Rotate 2 normalized orthogonal vectors in direction from `source` to `target`
-static void rotate2(LLVector3& source, LLVector3& target, F32 angle)
-{
- F32 sx = source[VX], sy = source[VY], sz = source[VZ];
- F32 tx = target[VX], ty = target[VY], tz = target[VZ];
- F32 c = cosf(angle), s = sinf(angle);
-
- source.set(sx * c + tx * s, sy * c + ty * s, sz * c + tz * s);
- target.set(tx * c - sx * s, ty * c - sy * s, tz * c - sz * s);
-}
-
void LLCoordFrame::roll(F32 angle)
{
- rotate2(mYAxis, mZAxis, angle);
+ LLQuaternion q(angle, mXAxis);
+ LLMatrix3 rotation_matrix(q);
+ rotate(rotation_matrix);
+ CHECK_FINITE_OBJ();
}
void LLCoordFrame::pitch(F32 angle)
{
- rotate2(mZAxis, mXAxis, angle);
+ LLQuaternion q(angle, mYAxis);
+ LLMatrix3 rotation_matrix(q);
+ rotate(rotation_matrix);
+ CHECK_FINITE_OBJ();
}
void LLCoordFrame::yaw(F32 angle)
{
- rotate2(mXAxis, mYAxis, angle);
+ LLQuaternion q(angle, mZAxis);
+ LLMatrix3 rotation_matrix(q);
+ rotate(rotation_matrix);
+ CHECK_FINITE_OBJ();
}
// get*() routines