MCPcopy Create free account
hub / github.com/EricLengyel/Terathon-Math-Library / GetRotationMatrix

Method GetRotationMatrix

TSQuaternion.cpp:43–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43Matrix3D Quaternion::GetRotationMatrix(void) const
44{
45 // See FGED1, Section 2.7.
46
47 float x2 = x * x;
48 float y2 = y * y;
49 float z2 = z * z;
50 float xy = x * y;
51 float zx = z * x;
52 float yz = y * z;
53 float wx = w * x;
54 float wy = w * y;
55 float wz = w * z;
56
57 return (Matrix3D(1.0F - 2.0F * (y2 + z2), 2.0F * (xy - wz), 2.0F * (zx + wy),
58 2.0F * (xy + wz), 1.0F - 2.0F * (x2 + z2), 2.0F * (yz - wx),
59 2.0F * (zx - wy), 2.0F * (yz + wx), 1.0F - 2.0F * (x2 + y2)));
60}
61
62template <class matrix>
63Quaternion& Quaternion::SetRotationMatrix(const matrix& M)

Callers

nothing calls this directly

Calls 1

Matrix3DClass · 0.85

Tested by

no test coverage detected