diff options
| author | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-11-25 22:34:59 +0200 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-11-25 22:34:59 +0200 |
| commit | a58abdac5fd642ee320345bd1eef0df253895dba (patch) | |
| tree | c71007ccb2746b7bef7949c2c978cbfe768392ce /indra/llmath/llcoordframe.cpp | |
| parent | 624eaf59a02dbd2f002fb45af01bbc17f04f8331 (diff) | |
| parent | 9fe788e031e83aa6bfbb7bc9144079d2814018e8 (diff) | |
Merge branch develop into project/fonts-update
# Conflicts:
# indra/llrender/llfontfreetype.cpp
Diffstat (limited to 'indra/llmath/llcoordframe.cpp')
| -rw-r--r-- | indra/llmath/llcoordframe.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/indra/llmath/llcoordframe.cpp b/indra/llmath/llcoordframe.cpp index 4d6276b2cd..b42541c7c0 100644 --- a/indra/llmath/llcoordframe.cpp +++ b/indra/llmath/llcoordframe.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" -//#include "vmath.h" #include "v3math.h" #include "m3math.h" #include "v4math.h" @@ -329,28 +328,30 @@ 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) { - LLQuaternion q(angle, mXAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mYAxis, mZAxis, angle); } void LLCoordFrame::pitch(F32 angle) { - LLQuaternion q(angle, mYAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mZAxis, mXAxis, angle); } void LLCoordFrame::yaw(F32 angle) { - LLQuaternion q(angle, mZAxis); - LLMatrix3 rotation_matrix(q); - rotate(rotation_matrix); - CHECK_FINITE_OBJ(); + rotate2(mXAxis, mYAxis, angle); } // get*() routines |
