MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / toRotationMatrix

Method toRotationMatrix

engine/source/runtime/core/math/quaternion.cpp:62–86  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

60 }
61 //-----------------------------------------------------------------------
62 void Quaternion::toRotationMatrix(Matrix3x3& kRot) const
63 {
64 float fTx = x + x; // 2x
65 float fTy = y + y; // 2y
66 float fTz = z + z; // 2z
67 float fTwx = fTx * w; // 2xw
68 float fTwy = fTy * w; // 2yw
69 float fTwz = fTz * w; // 2z2
70 float fTxx = fTx * x; // 2x^2
71 float fTxy = fTy * x; // 2xy
72 float fTxz = fTz * x; // 2xz
73 float fTyy = fTy * y; // 2y^2
74 float fTyz = fTz * y; // 2yz
75 float fTzz = fTz * z; // 2z^2
76
77 kRot[0][0] = 1.0f - (fTyy + fTzz); // 1 - 2y^2 - 2z^2
78 kRot[0][1] = fTxy - fTwz; // 2xy - 2wz
79 kRot[0][2] = fTxz + fTwy; // 2xz + 2wy
80 kRot[1][0] = fTxy + fTwz; // 2xy + 2wz
81 kRot[1][1] = 1.0f - (fTxx + fTzz); // 1 - 2x^2 - 2z^2
82 kRot[1][2] = fTyz - fTwx; // 2yz - 2wx
83 kRot[2][0] = fTxz - fTwy; // 2xz - 2wy
84 kRot[2][1] = fTyz + fTwx; // 2yz + 2wx
85 kRot[2][2] = 1.0f - (fTxx + fTyy); // 1 - 2x^2 - 2y^2
86 }
87
88 void Quaternion::toRotationMatrix(Matrix4x4& kRot) const
89 {

Callers 5

makeTransformMethod · 0.80
makeInverseTransformMethod · 0.80
Matrix4x4Method · 0.80
makeViewMatrixMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected