MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / RotationQuaternion

Method RotationQuaternion

Source/Engine/Core/Math/Matrix.cpp:607–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605}
606
607void Matrix::RotationQuaternion(const Quaternion& rotation, Matrix& result)
608{
609 const float xx = rotation.X * rotation.X;
610 const float yy = rotation.Y * rotation.Y;
611 const float zz = rotation.Z * rotation.Z;
612 const float xy = rotation.X * rotation.Y;
613 const float zw = rotation.Z * rotation.W;
614 const float zx = rotation.Z * rotation.X;
615 const float yw = rotation.Y * rotation.W;
616 const float yz = rotation.Y * rotation.Z;
617 const float xw = rotation.X * rotation.W;
618
619 result.M11 = 1.0f - 2.0f * (yy + zz);
620 result.M12 = 2.0f * (xy + zw);
621 result.M13 = 2.0f * (zx - yw);
622 result.M14 = 0;
623
624 result.M21 = 2.0f * (xy - zw);
625 result.M22 = 1.0f - 2.0f * (zz + xx);
626 result.M23 = 2.0f * (yz + xw);
627 result.M24 = 0;
628
629 result.M31 = 2.0f * (zx + yw);
630 result.M32 = 2.0f * (yz - xw);
631 result.M33 = 1.0f - 2.0f * (yy + xx);
632 result.M34 = 0;
633
634 result.M41 = 0;
635 result.M42 = 0;
636 result.M43 = 0;
637 result.M44 = 1;
638}
639
640void Matrix::RotationYawPitchRoll(float yaw, float pitch, float roll, Matrix& result)
641{

Callers 14

TestWorldMatrixMethod · 0.45
TestLocalToWorldMethod · 0.45
TestWorldToLocalMethod · 0.45
GetWorldMatrixMethod · 0.45
GetRotationMethod · 0.45
UpdateTranslateScaleMethod · 0.45
ApplyTransformMethod · 0.45
RotateSelectionMethod · 0.45
ApplyTransformMethod · 0.45
DrawMethod · 0.45
DrawMethod · 0.45
DrawMethod · 0.45

Calls

no outgoing calls

Tested by 3

TestWorldMatrixMethod · 0.36
TestLocalToWorldMethod · 0.36
TestWorldToLocalMethod · 0.36