utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::graphic::Orientation< OrientationComponentType > Class Template Reference

Represents the current 3D orientation (pose) of an object or view. More...

#include <headers/utility/graphic/orientation.hpp>

Inheritance diagram for utility::graphic::Orientation< OrientationComponentType >:
Collaboration diagram for utility::graphic::Orientation< OrientationComponentType >:

Public Member Functions

 Orientation (void)
 Default constructor (identity orientation).
 
 Orientation (OrientationComponentType value)
 Construct by filling all components with the same OrientationComponentType value.
 
 Orientation (const utility::math::Quaternion< OrientationComponentType > &quaternion)
 Construct from a quaternion.
 
 Orientation (OrientationComponentType x, OrientationComponentType y, OrientationComponentType z, OrientationComponentType w)
 Construct from explicit quaternion components (xyzw order).
 
 Orientation (std::initializer_list< OrientationComponentType > values)
 Construct from initializer list of three PositionComponentType values.
 
 Orientation (const std::initializer_list< OrientationComponentType > &value)
 Construct from a const initializer list of three PositionComponentType values.
 
 Orientation (const Orientation &other)=default
 Copy constructor.
 
 Orientation (Orientation &&other) noexcept=default
 Move constructor.
 
Orientationoperator= (const Orientation &other)=default
 Copy assignment operator.
 
Orientationoperator= (Orientation &&other) noexcept=default
 Move assignment operator.
 
 ~Orientation (void)=default
 Default destructor for Orientation.
 
utility::math::Vector< OrientationComponentType, 3 > getForward (void) const noexcept
 Get the forward (Z-) axis in world space.
 
utility::math::Vector< OrientationComponentType, 3 > getUp (void) const noexcept
 Get the up (Y+) axis in world space.
 
utility::math::Vector< OrientationComponentType, 3 > getRight (void) const noexcept
 Get the right (X+) axis in world space.
 
utility::math::Vector< OrientationComponentType, 3 > transformPoint (const utility::math::Vector< OrientationComponentType, 3 > &local) const noexcept
 Transform a point from local to world space.
 
utility::math::Vector< OrientationComponentType, 3 > rotateVector (const utility::math::Vector< OrientationComponentType, 3 > &direction) const noexcept
 Rotate a direction vector by this orientation.
 
Orientation combined (const Orientation &parent) const noexcept
 Combine with another orientation (parent * this).
 
math::Matrix4x4F toRotationMatrix (void) const noexcept
 Convert the orientation to a 4x4 rotation matrix.
 
Orientation normalized (void) const noexcept
 Return a normalized orientation.
 
Orientation inversed (void) const noexcept
 Return inverse orientation.
 
bool isIdentity (OrientationComponentType epsilon=OrientationComponentType { 1e-6 }) const noexcept
 Check whether this is approximately the identity orientation.
 
bool operator== (const Orientation &other) const noexcept
 Equality operator for Orientation.
 
bool operator!= (const Orientation &other) const noexcept
 Inequality operator for Orientation.
 
bool operator< (const Orientation &other) const noexcept
 Less-than operator for Orientation.
 
- Public Member Functions inherited from utility::math::Quaternion< OrientationComponentType >
 Quaternion ()
 Default constructor (identity quaternion).
 
 Quaternion (QuaternionComponentType x, QuaternionComponentType y, QuaternionComponentType z, QuaternionComponentType w)
 Construct from explicit components in (x, y, z, w) order.
 
 Quaternion (const glm::qua< QuaternionComponentType > &q)
 Construct from a GLM quaternion.
 
 Quaternion (const Quaternion &other)=default
 Copy constructor.
 
 Quaternion (Quaternion &&other) noexcept=default
 Move constructor.
 
 ~Quaternion ()=default
 Default destructor for Quaternion.
 
Quaternionoperator= (const Quaternion &other)=default
 Copy assignment operator.
 
Quaternionoperator= (Quaternion &&other) noexcept=default
 Move assignment operator.
 
Quaternion operator+ (const Quaternion &rhs) const noexcept
 Quaternion addition.
 
Quaternionoperator+= (const Quaternion &rhs) noexcept
 Quaternion addition assignment.
 
Quaternion operator- (const Quaternion &rhs) const noexcept
 Quaternion subtraction.
 
Quaternion operator- (void) const noexcept
 Unary negation.
 
Quaternionoperator-= (const Quaternion &rhs) noexcept
 Quaternion subtraction assignment.
 
Quaternion operator* (const Quaternion &rhs) const noexcept
 Quaternion multiplication (Hamilton product).
 
Quaternion operator* (QuaternionComponentType scalar) const noexcept
 Scalar multiplication.
 
Quaternionoperator*= (const Quaternion &rhs) noexcept
 Quaternion multiplication assignment (Hamilton product).
 
Quaternionoperator*= (QuaternionComponentType scalar) noexcept
 Scalar multiplication assignment.
 
bool operator== (const Quaternion &rhs) const noexcept
 Equality comparison.
 
bool equalsEpsilon (const Quaternion &rhs, QuaternionComponentType epsilon=QuaternionComponentType { 1e-5 }) const
 Approximate equality using an epsilon threshold.
 
bool operator!= (const Quaternion &rhs) const noexcept
 Inequality comparison.
 

Detailed Description

template<CanBeOrientationComponent OrientationComponentType>
class utility::graphic::Orientation< OrientationComponentType >

Represents the current 3D orientation (pose) of an object or view.

Template Parameters
OrientationComponentTypeFloating-point type for quaternion components.
Note
An orientation describes how the object is rotated in space relative to a reference frame (e.g. world or parent), but does not describe the history of how it got there.

Definition at line 53 of file orientation.hpp.

Constructor & Destructor Documentation

◆ Orientation() [1/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( void  )
inline

Default constructor (identity orientation).

Note
Initializes to no rotation (facing -Z, up +Y).

Definition at line 62 of file orientation.hpp.

Here is the caller graph for this function:

◆ Orientation() [2/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( OrientationComponentType  value)
inlineexplicit

Construct by filling all components with the same OrientationComponentType value.

Parameters
valueThe OrientationComponentType value to fill all components with.

Definition at line 75 of file orientation.hpp.

◆ Orientation() [3/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( const utility::math::Quaternion< OrientationComponentType > &  quaternion)
inlineexplicit

Construct from a quaternion.

Parameters
quaternionQuaternion to use for orientation.

Definition at line 85 of file orientation.hpp.

◆ Orientation() [4/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( OrientationComponentType  x,
OrientationComponentType  y,
OrientationComponentType  z,
OrientationComponentType  w 
)
inline

Construct from explicit quaternion components (xyzw order).

Parameters
xX component.
yY component.
zZ component.
wW component.

Definition at line 99 of file orientation.hpp.

◆ Orientation() [5/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( std::initializer_list< OrientationComponentType >  values)
inline

Construct from initializer list of three PositionComponentType values.

Parameters
valuesThe initializer list containing x, y, z components.
Exceptions
std::invalid_argumentif the list size is not 3.

Definition at line 111 of file orientation.hpp.

◆ Orientation() [6/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( const std::initializer_list< OrientationComponentType > &  value)
inline

Construct from a const initializer list of three PositionComponentType values.

Parameters
valueSource vector.

Definition at line 132 of file orientation.hpp.

◆ Orientation() [7/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( const Orientation< OrientationComponentType > &  other)
default

Copy constructor.

Parameters
otherThe Orientation object to copy from.

◆ Orientation() [8/8]

template<CanBeOrientationComponent OrientationComponentType>
utility::graphic::Orientation< OrientationComponentType >::Orientation ( Orientation< OrientationComponentType > &&  other)
defaultnoexcept

Move constructor.

Parameters
otherThe Orientation object to move from.

Member Function Documentation

◆ combined()

template<CanBeOrientationComponent OrientationComponentType>
Orientation utility::graphic::Orientation< OrientationComponentType >::combined ( const Orientation< OrientationComponentType > &  parent) const
inlinenoexcept

Combine with another orientation (parent * this).

Parameters
parentParent orientation to combine with.
Returns
Combined orientation (parent * this).

Definition at line 246 of file orientation.hpp.

Here is the call graph for this function:

◆ getForward()

template<CanBeOrientationComponent OrientationComponentType>
utility::math::Vector< OrientationComponentType, 3 > utility::graphic::Orientation< OrientationComponentType >::getForward ( void  ) const
inlinenoexcept

Get the forward (Z-) axis in world space.

Returns
Forward direction as a 3D vector.

Definition at line 174 of file orientation.hpp.

Here is the caller graph for this function:

◆ getRight()

template<CanBeOrientationComponent OrientationComponentType>
utility::math::Vector< OrientationComponentType, 3 > utility::graphic::Orientation< OrientationComponentType >::getRight ( void  ) const
inlinenoexcept

Get the right (X+) axis in world space.

Returns
Right direction as a 3D vector.

Definition at line 204 of file orientation.hpp.

Here is the caller graph for this function:

◆ getUp()

template<CanBeOrientationComponent OrientationComponentType>
utility::math::Vector< OrientationComponentType, 3 > utility::graphic::Orientation< OrientationComponentType >::getUp ( void  ) const
inlinenoexcept

Get the up (Y+) axis in world space.

Returns
Up direction as a 3D vector.

Definition at line 189 of file orientation.hpp.

Here is the caller graph for this function:

◆ inversed()

template<CanBeOrientationComponent OrientationComponentType>
Orientation utility::graphic::Orientation< OrientationComponentType >::inversed ( void  ) const
inlinenoexcept

Return inverse orientation.

Returns
Inverse quaternion orientation.

Definition at line 288 of file orientation.hpp.

Here is the call graph for this function:

◆ isIdentity()

template<CanBeOrientationComponent OrientationComponentType>
bool utility::graphic::Orientation< OrientationComponentType >::isIdentity ( OrientationComponentType  epsilon = OrientationComponentType { 1e-6 }) const
inlinenoexcept

Check whether this is approximately the identity orientation.

Parameters
epsilonAbsolute tolerance for each component.
Returns
True when x,y,z are near 0 and w is near 1.

Definition at line 302 of file orientation.hpp.

◆ normalized()

template<CanBeOrientationComponent OrientationComponentType>
Orientation utility::graphic::Orientation< OrientationComponentType >::normalized ( void  ) const
inlinenoexcept

Return a normalized orientation.

Returns
Orientation with unit quaternion length.

Definition at line 275 of file orientation.hpp.

Here is the call graph for this function:

◆ operator!=()

template<CanBeOrientationComponent OrientationComponentType>
bool utility::graphic::Orientation< OrientationComponentType >::operator!= ( const Orientation< OrientationComponentType > &  other) const
inlinenoexcept

Inequality operator for Orientation.

Parameters
otherThe other Orientation to compare with.
Returns
True if the orientations are not equal, false otherwise.

Definition at line 338 of file orientation.hpp.

◆ operator<()

template<CanBeOrientationComponent OrientationComponentType>
bool utility::graphic::Orientation< OrientationComponentType >::operator< ( const Orientation< OrientationComponentType > &  other) const
inlinenoexcept

Less-than operator for Orientation.

Parameters
otherThe other Orientation to compare with.
Returns
True if this orientation is less than the other, false otherwise.

Definition at line 349 of file orientation.hpp.

◆ operator=() [1/2]

template<CanBeOrientationComponent OrientationComponentType>
Orientation & utility::graphic::Orientation< OrientationComponentType >::operator= ( const Orientation< OrientationComponentType > &  other)
default

Copy assignment operator.

Parameters
otherThe Orientation object to copy from.
Returns
A reference to this Orientation object.

◆ operator=() [2/2]

template<CanBeOrientationComponent OrientationComponentType>
Orientation & utility::graphic::Orientation< OrientationComponentType >::operator= ( Orientation< OrientationComponentType > &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherThe Orientation object to move from.
Returns
A reference to this Orientation object.

◆ operator==()

template<CanBeOrientationComponent OrientationComponentType>
bool utility::graphic::Orientation< OrientationComponentType >::operator== ( const Orientation< OrientationComponentType > &  other) const
inlinenoexcept

Equality operator for Orientation.

Parameters
otherThe other Orientation to compare with.
Returns
True if the orientations are equal, false otherwise.

Definition at line 316 of file orientation.hpp.

◆ rotateVector()

template<CanBeOrientationComponent OrientationComponentType>
utility::math::Vector< OrientationComponentType, 3 > utility::graphic::Orientation< OrientationComponentType >::rotateVector ( const utility::math::Vector< OrientationComponentType, 3 > &  direction) const
inlinenoexcept

Rotate a direction vector by this orientation.

Parameters
directionDirection in local space.
Returns
Rotated direction in world space.

Definition at line 234 of file orientation.hpp.

Here is the call graph for this function:

◆ toRotationMatrix()

template<CanBeOrientationComponent OrientationComponentType>
math::Matrix4x4F utility::graphic::Orientation< OrientationComponentType >::toRotationMatrix ( void  ) const
inlinenoexcept

Convert the orientation to a 4x4 rotation matrix.

Returns
Rotation matrix corresponding to this orientation.
Note
The resulting matrix can be used for transforming vertices or constructing view matrices, but does not include translation or scaling components. It represents only the rotation defined by the quaternion.

Definition at line 264 of file orientation.hpp.

◆ transformPoint()

template<CanBeOrientationComponent OrientationComponentType>
utility::math::Vector< OrientationComponentType, 3 > utility::graphic::Orientation< OrientationComponentType >::transformPoint ( const utility::math::Vector< OrientationComponentType, 3 > &  local) const
inlinenoexcept

Transform a point from local to world space.

Parameters
localPoint in local space.
Returns
Transformed point in world space.

Definition at line 219 of file orientation.hpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: