Castor3D 0.16.0
Multiplatform 3D engine
|
Quaternion representation class. More...
#include <Quaternion.hpp>
Public Member Functions | |
QuaternionT () | |
Constructor. | |
QuaternionT (QuaternionT const &rhs) | |
Copy Constructor. | |
QuaternionT (QuaternionT &&rhs) noexcept | |
Move Constructor. | |
QuaternionT (double const *values) | |
Constructor. | |
QuaternionT (float const *values) | |
Constructor. | |
QuaternionT (Point4f const &values) | |
Constructor. | |
QuaternionT (Point4d const &values) | |
Constructor. | |
~QuaternionT () noexcept=default | |
Destructor. | |
QuaternionT< T > & | operator= (QuaternionT< T > const &rhs) |
Copy assignment operator. | |
QuaternionT< T > & | operator= (QuaternionT< T > &&rhs) noexcept |
Move assignment operator. | |
QuaternionT< T > & | operator+= (QuaternionT< T > const &rhs) |
addition assignment operator | |
QuaternionT< T > & | operator-= (QuaternionT< T > const &rhs) |
Substraction assignment operator. | |
QuaternionT< T > & | operator*= (QuaternionT< T > const &rhs) |
Multiplication assignment operator. | |
QuaternionT< T > & | operator*= (double rhs) |
Multiplication assignment operator. | |
QuaternionT< T > & | operator*= (float rhs) |
Multiplication assignment operator. | |
template<Vector3fT PtT> | |
PtT & | transform (PtT const &vector, PtT &result) const |
Transforms a vector and gives the result. | |
template<Vector3dT PtT> | |
PtT & | transform (PtT const &vector, PtT &result) const |
Transforms a vector and gives the result. | |
void | toMatrix (float *matrix) const |
Fills a rotation matrix from this Quaternion. | |
void | toMatrix (double *matrix) const |
Fills a rotation matrix from this Quaternion. | |
void | toMatrix (Matrix4x4f &matrix) const |
Fills a rotation matrix from this Quaternion. | |
void | toMatrix (Matrix4x4d &matrix) const |
Fills a rotation matrix from this Quaternion. | |
void | toAxisAngle (Point3f &vector, Angle &angle) const |
Gives the axis and the angle from this Quaternion. | |
void | toAxisAngle (Point3d &vector, Angle &angle) const |
Gives the axis and the angle from this Quaternion. | |
void | toAxes (Point3f &x, Point3f &y, Point3f &z) const |
Computes 3 axes from this quaternion. | |
void | toAxes (Point3d &x, Point3d &y, Point3d &z) const |
Computes 3 axes from this quaternion. | |
void | conjugate () |
sets this Quaternion to its conjugate | |
QuaternionT< T > | getConjugate () const |
Retrieves the conjugate of this Quaternion. | |
double | getMagnitude () const |
Retrieves the magnitude of this Quaternion. | |
AngleT< T > | getPitch () const |
AngleT< T > | getYaw () const |
AngleT< T > | getRoll () const |
QuaternionT< T > | mix (QuaternionT< T > const &target, double factor) const |
Spherical linear interpolation another quaternions. | |
QuaternionT< T > | mix (QuaternionT< T > const &target, float factor) const |
Spherical linear interpolation another quaternions. | |
QuaternionT< T > | lerp (QuaternionT< T > const &target, double factor) const |
Linear interpolation of two quaternions. | |
QuaternionT< T > | lerp (QuaternionT< T > const &target, float factor) const |
Linear interpolation of two quaternions. | |
QuaternionT< T > | slerp (QuaternionT< T > const &target, double factor) const |
Spherical linear interpolation with another quaternions. | |
QuaternionT< T > | slerp (QuaternionT< T > const &target, float factor) const |
Spherical linear interpolation with another quaternions. | |
PointData< T, 4u > * | operator-> () |
PointData< T, 4u > const * | operator-> () const |
Public Member Functions inherited from castor::DataHolderT< QuaternionDataT< T > > | |
DataHolderT () noexcept=default | |
DataHolderT (QuaternionDataT< T > d) noexcept | |
QuaternionDataT< T > & | getData () |
QuaternionDataT< T > const & | getData () const |
void | setData (QuaternionDataT< T > data) |
Public Member Functions inherited from castor::Coords< T, Count > | |
void | swap (Coords &rhs) noexcept |
Swaps this pont data with the parameter ones. | |
uint32_t | size () const |
T const & | operator[] (uint32_t index) const |
Retrieves the data at given index. | |
T & | operator[] (uint32_t index) |
Retrieves the data at given index. | |
T * | ptr () |
Retrieves a non constant pointer on datas. | |
T const * | constPtr () const |
Retrieves a constant pointer on datas. | |
iterator | begin () |
Retrieves an iterator to the first element. | |
const_iterator | begin () const |
Retrieves a constant iterator to the first element. | |
iterator | end () |
Retrieves an iterator to the last element. | |
const_iterator | end () const |
Retrieves a constant iterator to the last element. | |
Coords ()=default | |
Coords (Point< T, Count > &rhs) | |
Coords (T *rhs) | |
Coords & | operator= (T *rhs) |
Coords & | operator= (Point< T, Count > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator+= (Coords< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator-= (Coords< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator*= (Coords< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator/= (Coords< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator+= (Point< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator-= (Point< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator*= (Point< U, UCount > const &rhs) |
template<typename U , uint32_t UCount> | |
Coords & | operator/= (Point< U, UCount > const &rhs) |
template<typename U > | |
Coords & | operator+= (U const *coords) |
template<typename U > | |
Coords & | operator-= (U const *coords) |
template<typename U > | |
Coords & | operator*= (U const *coords) |
template<typename U > | |
Coords & | operator/= (U const *coords) |
Coords & | operator+= (T const &coord) |
Coords & | operator-= (T const &coord) |
Coords & | operator*= (T const &coord) |
Coords & | operator/= (T const &coord) |
Static Public Member Functions | |
static QuaternionT< T > | fromMatrix (Matrix4x4f const &matrix) |
Updates this Quaternion from a rotation matrix. | |
static QuaternionT< T > | fromMatrix (Matrix4x4d const &matrix) |
Updates this Quaternion from a rotation matrix. | |
static QuaternionT< T > | fromMatrix (float const *matrix) |
Updates this Quaternion from a rotation matrix. | |
static QuaternionT< T > | fromMatrix (double const *matrix) |
Updates this Quaternion from a rotation matrix. | |
static QuaternionT< T > | fromAxisAngle (Point3f const &vector, Angle const &angle) |
Updates this Quaternion from an axis and an angle. | |
static QuaternionT< T > | fromAxisAngle (Point3d const &vector, Angle const &angle) |
Updates this Quaternion from an axis and an angle. | |
static QuaternionT< T > | fromAxes (Point3f const &x, Point3f const &y, Point3f const &z) |
Updates this Quaternion from 3 axes. | |
static QuaternionT< T > | fromAxes (Point3d const &x, Point3d const &y, Point3d const &z) |
Updates this Quaternion from 3 axes. | |
static QuaternionT< T > | fromComponents (float x, float y, float z, float w) |
Updates this Quaternion from 4 components. | |
static QuaternionT< T > | fromComponents (double x, double y, double z, double w) |
Updates this Quaternion from 4 components. | |
static QuaternionT< T > | identity () |
Retrieves the Quaternion identity. | |
static QuaternionT< T > | null () |
Retrieves the null Quaternion. | |
Additional Inherited Members | |
Public Types inherited from castor::Coords< T, Count > | |
using | iterator = value_type * |
using | const_iterator = value_type const * |
Quaternion representation class.
castor::QuaternionT< T >::QuaternionT | ( | ) |
Constructor.
castor::QuaternionT< T >::QuaternionT | ( | QuaternionT< T > const & | rhs | ) |
Copy Constructor.
[in] | rhs | The Quaternion object to copy |
|
noexcept |
Move Constructor.
[in] | rhs | The Quaternion object to move |
|
explicit |
Constructor.
[in] | values | The Quaternion values |
|
explicit |
Constructor.
[in] | values | The Quaternion values |
|
explicit |
Constructor.
[in] | values | The quaternion values |
|
explicit |
Constructor.
[in] | values | The quaternion values |
|
defaultnoexcept |
Destructor.
void castor::QuaternionT< T >::conjugate | ( | ) |
sets this Quaternion to its conjugate
|
static |
Updates this Quaternion from 3 axes.
[in] | x,y,z | The axes |
|
static |
Updates this Quaternion from 3 axes.
[in] | x,y,z | The axes |
|
static |
Updates this Quaternion from an axis and an angle.
[in] | vector | The axis |
[in] | angle | The angle |
|
static |
Updates this Quaternion from an axis and an angle.
[in] | vector | The axis |
[in] | angle | The angle |
|
static |
Updates this Quaternion from 4 components.
[in] | x,y,z,w | The components |
|
static |
Updates this Quaternion from 4 components.
[in] | x,y,z,w | The components |
|
static |
Updates this Quaternion from a rotation matrix.
[in] | matrix | The rotation matrix |
|
static |
Updates this Quaternion from a rotation matrix.
[in] | matrix | The rotation matrix |
|
static |
Updates this Quaternion from a rotation matrix.
[in] | matrix | The rotation matrix |
|
static |
Updates this Quaternion from a rotation matrix.
[in] | matrix | The rotation matrix |
QuaternionT< T > castor::QuaternionT< T >::getConjugate | ( | ) | const |
Retrieves the conjugate of this Quaternion.
double castor::QuaternionT< T >::getMagnitude | ( | ) | const |
Retrieves the magnitude of this Quaternion.
AngleT< T > castor::QuaternionT< T >::getPitch | ( | ) | const |
AngleT< T > castor::QuaternionT< T >::getRoll | ( | ) | const |
AngleT< T > castor::QuaternionT< T >::getYaw | ( | ) | const |
|
static |
Retrieves the Quaternion identity.
QuaternionT< T > castor::QuaternionT< T >::lerp | ( | QuaternionT< T > const & | target, |
double | factor ) const |
Linear interpolation of two quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined in the range [0, 1]. |
QuaternionT< T > castor::QuaternionT< T >::lerp | ( | QuaternionT< T > const & | target, |
float | factor ) const |
Linear interpolation of two quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined in the range [0, 1]. |
QuaternionT< T > castor::QuaternionT< T >::mix | ( | QuaternionT< T > const & | target, |
double | factor ) const |
Spherical linear interpolation another quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined beyond the range [0, 1]. |
QuaternionT< T > castor::QuaternionT< T >::mix | ( | QuaternionT< T > const & | target, |
float | factor ) const |
Spherical linear interpolation another quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined beyond the range [0, 1]. |
|
static |
Retrieves the null Quaternion.
QuaternionT< T > & castor::QuaternionT< T >::operator*= | ( | double | rhs | ) |
Multiplication assignment operator.
[in] | rhs | The scalar to multiply |
QuaternionT< T > & castor::QuaternionT< T >::operator*= | ( | float | rhs | ) |
Multiplication assignment operator.
[in] | rhs | The scalar to multiply |
QuaternionT< T > & castor::QuaternionT< T >::operator*= | ( | QuaternionT< T > const & | rhs | ) |
Multiplication assignment operator.
[in] | rhs | The Quaternion object to multiply |
QuaternionT< T > & castor::QuaternionT< T >::operator+= | ( | QuaternionT< T > const & | rhs | ) |
addition assignment operator
[in] | rhs | The Quaternion object to add |
QuaternionT< T > & castor::QuaternionT< T >::operator-= | ( | QuaternionT< T > const & | rhs | ) |
Substraction assignment operator.
[in] | rhs | The Quaternion object to subtract |
|
inline |
References castor::DataHolderT< QuaternionDataT< T > >::getData().
|
inline |
References castor::DataHolderT< QuaternionDataT< T > >::getData().
|
noexcept |
Move assignment operator.
[in] | rhs | The Quaternion object to move |
QuaternionT< T > & castor::QuaternionT< T >::operator= | ( | QuaternionT< T > const & | rhs | ) |
Copy assignment operator.
[in] | rhs | The Quaternion object to copy |
QuaternionT< T > castor::QuaternionT< T >::slerp | ( | QuaternionT< T > const & | target, |
double | factor ) const |
Spherical linear interpolation with another quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined beyond the range [0, 1]. |
Referenced by castor3d::InterpolatorT< castor::Quaternion, InterpolatorType::eLinear >::interpolate().
QuaternionT< T > castor::QuaternionT< T >::slerp | ( | QuaternionT< T > const & | target, |
float | factor ) const |
Spherical linear interpolation with another quaternions.
[in] | target | The target quaternion |
[in] | factor | The interpolation factor. The interpolation is defined beyond the range [0, 1]. |
void castor::QuaternionT< T >::toAxes | ( | Point3d & | x, |
Point3d & | y, | ||
Point3d & | z ) const |
Computes 3 axes from this quaternion.
[out] | x,y,z | The axes |
void castor::QuaternionT< T >::toAxes | ( | Point3f & | x, |
Point3f & | y, | ||
Point3f & | z ) const |
Computes 3 axes from this quaternion.
[out] | x,y,z | The axes |
void castor::QuaternionT< T >::toAxisAngle | ( | Point3d & | vector, |
Angle & | angle ) const |
Gives the axis and the angle from this Quaternion.
[out] | vector | Receives the axis |
[out] | angle | Receives the angle |
void castor::QuaternionT< T >::toAxisAngle | ( | Point3f & | vector, |
Angle & | angle ) const |
Gives the axis and the angle from this Quaternion.
[out] | vector | Receives the axis |
[out] | angle | Receives the angle |
Referenced by castor3d::SceneNode::getAxisAngle().
void castor::QuaternionT< T >::toMatrix | ( | double * | matrix | ) | const |
Fills a rotation matrix from this Quaternion.
[out] | matrix | The rotation matrix to fill |
void castor::QuaternionT< T >::toMatrix | ( | float * | matrix | ) | const |
Fills a rotation matrix from this Quaternion.
[out] | matrix | The rotation matrix to fill |
void castor::QuaternionT< T >::toMatrix | ( | Matrix4x4d & | matrix | ) | const |
Fills a rotation matrix from this Quaternion.
[out] | matrix | The rotation matrix to fill |
void castor::QuaternionT< T >::toMatrix | ( | Matrix4x4f & | matrix | ) | const |
Fills a rotation matrix from this Quaternion.
[out] | matrix | The rotation matrix to fill |
PtT & castor::QuaternionT< T >::transform | ( | PtT const & | vector, |
PtT & | result ) const |
Transforms a vector and gives the result.
[in] | vector | The vector to transform |
[out] | result | Receives the result |
PtT & castor::QuaternionT< T >::transform | ( | PtT const & | vector, |
PtT & | result ) const |
Transforms a vector and gives the result.
[in] | vector | The vector to transform |
[out] | result | Receives the result |