Skip to content

Orientation

struct Orientation

Represents an orientation in 3D space.

This class provides methods for converting between different coordinate systems and manipulating orientations. The orientation can be built from yaw, pitch, and roll angles, or from a forward and up vector. Once built, the orientation is stored in the ZYX representation (yaw, pitch, roll), in the ZYZ representation, in the quaternion representation, and in forward-up vectors representation.

Functions

Name Description
Zero Gets a zero Orientation instance.
Orientation Constructs an Orientation instance with the given yaw, pitch, and roll angles.
Orientation Constructs an Orientation instance from a forward and up vector.
Orientation Constructs an Orientation instance from a quaternion.
GetYaw The angle of rotation around the Z-axis in radians following the ZYX convention.
GetPitch The angle of rotation around the Y-axis in radians following the ZYX convention.
GetRoll The angle of rotation around the X-axis in radians following the ZYX convention.
GetForward The forward vector of the orientation.
GetUp The up vector of the orientation.
GetAlpha The angle of rotation around the Z-axis in radians following the ZYZ convention.
GetBeta The angle of rotation around the Y-axis in radians following the ZYZ convention.
GetGamma The angle of rotation around the new Z-axis in radians following the ZYZ convention.
GetQuaternion The quaternion representation of the orientation.
GetRotationMatrix Converts the orientation to a rotation matrix.
GetLookAtMatrix Converts the orientation to a look-at matrix.

Function Details

GetAlpha

[[nodiscard]] inline AmReal32 GetAlpha() const

The angle of rotation around the Z-axis in radians following the ZYZ convention.

GetBeta

[[nodiscard]] inline AmReal32 GetBeta() const

The angle of rotation around the Y-axis in radians following the ZYZ convention.

GetForward

[[nodiscard]] inline AmVec3 GetForward() const

The forward vector of the orientation.

GetGamma

[[nodiscard]] inline AmReal32 GetGamma() const

The angle of rotation around the new Z-axis in radians following the ZYZ convention.

GetLookAtMatrix

[[nodiscard]] AmMat4 GetLookAtMatrix(AmVec3 eye) const

Converts the orientation to a look-at matrix.

Parameter eye
The eye's location.
Return
A look-at matrix representing the current orientation, with the eye at the given location.

GetPitch

[[nodiscard]] inline AmReal32 GetPitch() const

The angle of rotation around the Y-axis in radians following the ZYX convention.

GetQuaternion

[[nodiscard]] inline AmQuat GetQuaternion() const

The quaternion representation of the orientation.

GetRoll

[[nodiscard]] inline AmReal32 GetRoll() const

The angle of rotation around the X-axis in radians following the ZYX convention.

GetRotationMatrix

[[nodiscard]] AmMat4 GetRotationMatrix() const

Converts the orientation to a rotation matrix.

Return
A rotation matrix representing the current orientation.

GetUp

[[nodiscard]] inline AmVec3 GetUp() const

The up vector of the orientation.

GetYaw

[[nodiscard]] inline AmReal32 GetYaw() const

The angle of rotation around the Z-axis in radians following the ZYX convention.

Orientation

Orientation(AmReal32 yaw, AmReal32 pitch, AmReal32 roll)

Constructs an Orientation instance with the given yaw, pitch, and roll angles.

Parameter yaw
The angle of rotation around the X-axis in radians.
Parameter pitch
The angle of rotation around the Y-axis in radians.
Parameter roll
The angle of rotation around the Z-axis in radians.

Orientation(AmVec3 forward, AmVec3 up)

Constructs an Orientation instance from a forward and up vector.

Parameter forward
The forward vector of the orientation.
Parameter up
The up vector of the orientation.

Orientation(AmQuat quaternion)

Constructs an Orientation instance from a quaternion.

Parameter quaternion
The quaternion representing the orientation.

Zero

static Orientation Zero()

Gets a zero Orientation instance.

Return
A zero Orientation instance. 0 for all angles.