![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
Handles 3D rotations and conversions between various rotation representations. More...
#include <Rotation.h>
Public Member Functions | |
Rotation () | |
Default constructor. | |
Rotation (const Quaternion &quaternion) | |
Constructor from a Quaternion. | |
Rotation (const AxisAngle &axisAngle) | |
Constructor from an AxisAngle representation. | |
Rotation (const DirectionAngle &directionAngle) | |
Constructor from a DirectionAngle representation. | |
Rotation (const RotationMatrix &rotationMatrix) | |
Constructor from a RotationMatrix. | |
Rotation (const Vector3D &X, const Vector3D &Y, const Vector3D &Z) | |
Constructor from basis vectors. | |
Rotation (const EulerAngles &eulerAngles) | |
Constructor from Euler angles. | |
Rotation (const Vector3D &initial, const Vector3D &target) | |
Constructor from direction vectors. | |
Rotation (const YawPitchRoll &ypr) | |
Constructor from a YawPitchRoll representation. | |
Quaternion | GetQuaternion () |
Gets the quaternion representation of the rotation. | |
AxisAngle | GetAxisAngle () |
Gets the axis-angle representation of the rotation. | |
DirectionAngle | GetDirectionAngle () |
Gets the direction-angle representation of the rotation. | |
RotationMatrix | GetRotationMatrix () |
Gets the rotation matrix representation of the rotation. | |
EulerAngles | GetEulerAngles (const EulerOrder &order) |
Gets the Euler angles representation of the rotation. | |
YawPitchRoll | GetYawPitchRoll () |
Gets the yaw-pitch-roll representation of the rotation. | |
Private Attributes | |
Quaternion | quaternionRotation |
Quaternion representation of the rotation. | |
Handles 3D rotations and conversions between various rotation representations.
The Rotation
class simplifies the process of converting between multiple rotation representations, enabling flexible handling of 3D rotations in applications such as graphics and robotics.
Definition at line 32 of file Rotation.h.
Rotation | ( | ) |
Default constructor.
Initializes the rotation to the identity quaternion.
Definition at line 198 of file Rotation.cpp.
References quaternionRotation.
Referenced by QuaternionFromDirectionVectors().
Rotation | ( | const Quaternion & | quaternion | ) |
Constructor from a Quaternion.
quaternion | The quaternion representation of the rotation. |
Definition at line 202 of file Rotation.cpp.
References quaternionRotation.
Constructor from an AxisAngle representation.
axisAngle | The axis-angle representation of the rotation. |
Definition at line 206 of file Rotation.cpp.
References AxisAngleToQuaternion(), and quaternionRotation.
Rotation | ( | const DirectionAngle & | directionAngle | ) |
Constructor from a DirectionAngle representation.
directionAngle | The direction-angle representation of the rotation. |
Definition at line 210 of file Rotation.cpp.
References DirectionAngleToQuaternion(), and quaternionRotation.
Rotation | ( | const RotationMatrix & | rotationMatrix | ) |
Constructor from a RotationMatrix.
rotationMatrix | The rotation matrix representation of the rotation. |
Definition at line 214 of file Rotation.cpp.
References quaternionRotation, and RotationMatrixToQuaternion().
Constructor from basis vectors.
X | The X-axis vector. |
Y | The Y-axis vector. |
Z | The Z-axis vector. |
Definition at line 218 of file Rotation.cpp.
References quaternionRotation, and RotationMatrixToQuaternion().
Rotation | ( | const EulerAngles & | eulerAngles | ) |
Constructor from Euler angles.
eulerAngles | The Euler angles representation of the rotation. |
Definition at line 222 of file Rotation.cpp.
References EulerAnglesToQuaternion(), and quaternionRotation.
Constructor from direction vectors.
initial | The initial direction vector. |
target | The target direction vector. |
Definition at line 226 of file Rotation.cpp.
References QuaternionFromDirectionVectors(), and quaternionRotation.
Rotation | ( | const YawPitchRoll & | ypr | ) |
Constructor from a YawPitchRoll representation.
ypr | The yaw-pitch-roll representation of the rotation. |
Definition at line 230 of file Rotation.cpp.
References quaternionRotation, and YawPitchRollToQuaternion().
|
private |
Converts an AxisAngle to a Quaternion.
axisAngle | The axis-angle representation. |
Definition at line 5 of file Rotation.cpp.
References Mathematics::DegreesToRadians().
Referenced by Rotation().
|
private |
Converts a DirectionAngle to a Quaternion.
directionAngle | The direction-angle representation. |
Definition at line 17 of file Rotation.cpp.
References QuaternionFromDirectionVectors(), RotationMatrix::RotateVector(), RotationMatrixToQuaternion(), and Quaternion::UnitQuaternion().
Referenced by Rotation().
|
private |
Converts Euler angles to a Quaternion.
eulerAngles | The Euler angles representation. |
Definition at line 83 of file Rotation.cpp.
References Mathematics::DegreesToRadians(), EulerOrder::Rotating, EulerOrder::XYZ, EulerOrder::XZY, EulerOrder::YXZ, EulerOrder::YZX, EulerOrder::ZXY, and EulerOrder::ZYX.
Referenced by Rotation().
|
private |
Converts Euler angles to a RotationMatrix.
eulerAngles | The Euler angles representation. |
Definition at line 148 of file Rotation.cpp.
AxisAngle GetAxisAngle | ( | ) |
Gets the axis-angle representation of the rotation.
Definition at line 238 of file Rotation.cpp.
References quaternionRotation, and Mathematics::RadiansToDegrees().
DirectionAngle GetDirectionAngle | ( | ) |
Gets the direction-angle representation of the rotation.
Definition at line 266 of file Rotation.cpp.
References QuaternionFromDirectionVectors(), quaternionRotation, Mathematics::RadiansToDegrees(), Quaternion::UnitQuaternion(), Vector3D::X, and Vector3D::Z.
EulerAngles GetEulerAngles | ( | const EulerOrder & | order | ) |
Gets the Euler angles representation of the rotation.
order | The Euler order to use for conversion. |
Definition at line 300 of file Rotation.cpp.
References quaternionRotation, Mathematics::RadiansToDegrees(), EulerOrder::Rotating, EulerOrder::XYZ, EulerOrder::XZY, EulerOrder::YXZ, EulerOrder::YZX, EulerOrder::ZXY, and EulerOrder::ZYX.
Referenced by Transform::ToString().
Quaternion GetQuaternion | ( | ) |
Gets the quaternion representation of the rotation.
Definition at line 234 of file Rotation.cpp.
References quaternionRotation.
Referenced by CameraLayout::CalculateTransform(), ObjectAlign::GetPlaneNormal(), ObjectAlign::GetPlaneOrientation(), SpiralMaterial::GetRGB(), Transform::Rotate(), Transform::SetRotation(), AlphaAnimation::SpyroDisplay(), Transform::Transform(), Transform::Transform(), BNO055::Update(), ArtisansAnimation::Update(), BeeAnimation::Update(), CoelaBonkAnimation::Update(), CoelaNerdAnimation::Update(), CreeperAnimation::Update(), CubeAnimation::Update(), PikachuAnimation::Update(), RocksAnimation::Update(), and SpyroAnimation::Update().
RotationMatrix GetRotationMatrix | ( | ) |
Gets the rotation matrix representation of the rotation.
Definition at line 288 of file Rotation.cpp.
References quaternionRotation, and Quaternion::RotateVector().
YawPitchRoll GetYawPitchRoll | ( | ) |
Gets the yaw-pitch-roll representation of the rotation.
Definition at line 397 of file Rotation.cpp.
References quaternionRotation, and Mathematics::RadiansToDegrees().
|
private |
Creates a Quaternion from direction vectors.
initial | The initial direction vector. |
target | The target direction vector. |
Definition at line 154 of file Rotation.cpp.
References Vector3D::CrossProduct(), Vector3D::DotProduct(), Mathematics::MPI, and Rotation().
Referenced by DirectionAngleToQuaternion(), GetDirectionAngle(), and Rotation().
|
private |
Converts a RotationMatrix to Euler angles.
rM | The rotation matrix representation. |
order | The Euler order to use for conversion. |
Definition at line 142 of file Rotation.cpp.
|
private |
Converts a RotationMatrix to a Quaternion.
rM | The rotation matrix representation. |
Definition at line 37 of file Rotation.cpp.
References RotationMatrixToQuaternion().
Referenced by DirectionAngleToQuaternion(), Rotation(), Rotation(), and RotationMatrixToQuaternion().
|
private |
Converts three basis vectors to a Quaternion.
X | The X-axis vector. |
Y | The Y-axis vector. |
Z | The Z-axis vector. |
Definition at line 41 of file Rotation.cpp.
References Vector3D::X, Vector3D::Y, and Vector3D::Z.
|
private |
Converts a YawPitchRoll representation to a Quaternion.
ypr | The yaw-pitch-roll representation. |
Definition at line 136 of file Rotation.cpp.
Referenced by Rotation().
|
private |
Quaternion representation of the rotation.
Definition at line 34 of file Rotation.h.
Referenced by GetAxisAngle(), GetDirectionAngle(), GetEulerAngles(), GetQuaternion(), GetRotationMatrix(), GetYawPitchRoll(), Rotation(), Rotation(), Rotation(), Rotation(), Rotation(), Rotation(), Rotation(), Rotation(), and Rotation().