Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::EulerAngles< T > Class Template Reference

Math class that represents an Euler angle. Those describe a rotation transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order. More...

Public Member Functions

 EulerAngles (T P, T Y, T R)
 Constructs a EulerAngles object from its components. More...
 
 EulerAngles (const T angles[3])
 Constructs a EulerAngles object from an array of three elements. More...
 
 EulerAngles (const Quaternion< T > &quat)
 Constructs a EulerAngles object from a quaternion. More...
 
template<typename U >
 EulerAngles (const EulerAngles< U > &angles)
 Constructs a EulerAngles object from another type of EulerAngles. More...
 
 EulerAngles (const EulerAngles &angles)=default
 
void MakeZero ()
 Makes the euler angle (0, 0, 0) More...
 
EulerAnglesNormalize ()
 Normalizes the euler angle. More...
 
EulerAnglesSet (T P, T Y, T R)
 Sets the components of the euler angle. More...
 
EulerAnglesSet (const T angles[3])
 Sets the components of the euler angle from an array of three elements. More...
 
EulerAnglesSet (const EulerAngles< T > &angles)
 Sets the components of the euler angle from another euler angle. More...
 
EulerAnglesSet (const Quaternion< T > &quat)
 Sets the components of the euler angle from a quaternion. More...
 
template<typename U >
EulerAnglesSet (const EulerAngles< U > &angles)
 
Quaternion< T > ToQuaternion () const
 Converts the euler angle to quaternion. More...
 
String ToString () const
 Gives a string representation. More...
 
EulerAngles operator+ (const EulerAngles &angles) const
 Adds the components of the euler angle with other euler angle. More...
 
EulerAngles operator- (const EulerAngles &angles) const
 Substracts the components of the euler angle with other euler angle. More...
 
EulerAnglesoperator= (const EulerAngles &other)=default
 
EulerAnglesoperator+= (const EulerAngles &angles)
 Adds the components of other euler angle to this euler angle. More...
 
EulerAnglesoperator-= (const EulerAngles &angles)
 Substracts the components of other euler angle to this euler angle. More...
 
bool operator== (const EulerAngles &angles) const
 Compares the euler angle to other one. More...
 
bool operator!= (const EulerAngles &angles) const
 Compares the euler angle to other one. More...
 
template<typename U >
EulerAngles< T > & Set (const EulerAngles< U > &angles)
 Sets the components of the euler angle from another type of EulerAngles. More...
 

Static Public Member Functions

static EulerAngles Zero ()
 Shorthand for the euler angle (0, 0, 0) More...
 

Public Attributes

pitch
 
yaw
 
roll
 

Detailed Description

template<typename T>
class Nz::EulerAngles< T >

Math class that represents an Euler angle. Those describe a rotation transformation by rotating an object on its various axes in specified amounts per axis, and a specified axis order.

Remarks
Rotation are "right-handed", it means that you take your right hand, put your thumb finger in the direction you want and you other fingers represent the way of rotating

Constructor & Destructor Documentation

◆ EulerAngles() [1/4]

template<typename T >
Nz::EulerAngles< T >::EulerAngles ( P,
Y,
R 
)

Constructs a EulerAngles object from its components.

Parameters
PPitch component = X axis
YYaw component = Y axis
RRoll component = Z axis

◆ EulerAngles() [2/4]

template<typename T >
Nz::EulerAngles< T >::EulerAngles ( const T  angles[3])

Constructs a EulerAngles object from an array of three elements.

Parameters
angles[3]angles[0] is pitch component, angles[1] is yaw component and angles[2] is roll component

◆ EulerAngles() [3/4]

template<typename T >
Nz::EulerAngles< T >::EulerAngles ( const Quaternion< T > &  quat)

Constructs a EulerAngles object from a quaternion.

Parameters
quatQuaternion representing a rotation of space

◆ EulerAngles() [4/4]

template<typename T >
template<typename U >
Nz::EulerAngles< T >::EulerAngles ( const EulerAngles< U > &  angles)
explicit

Constructs a EulerAngles object from another type of EulerAngles.

Parameters
anglesEulerAngles of type U to convert to type T

Member Function Documentation

◆ MakeZero()

template<typename T >
void Nz::EulerAngles< T >::MakeZero ( )

Makes the euler angle (0, 0, 0)

Returns
A reference to this euler angle with components (0, 0, 0)
See also
Zero

◆ Normalize()

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::Normalize ( )

Normalizes the euler angle.

Returns
A reference to this euler angle with has been normalized
Remarks
Normalization depends on NAZARA_MATH_ANGLE_RADIAN, between 0..2*pi
See also
NormalizeAngle

◆ operator!=()

template<typename T >
bool Nz::EulerAngles< T >::operator!= ( const EulerAngles< T > &  angles) const

Compares the euler angle to other one.

Returns
false if the euler angles are the same
Parameters
anglesOther euler angle to compare with

◆ operator+()

template<typename T >
EulerAngles< T > Nz::EulerAngles< T >::operator+ ( const EulerAngles< T > &  angles) const

Adds the components of the euler angle with other euler angle.

Returns
A euler angle where components are the sum of this euler angle and the other one
Parameters
anglesThe other euler angle to add components with

◆ operator+=()

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::operator+= ( const EulerAngles< T > &  angles)

Adds the components of other euler angle to this euler angle.

Returns
A reference to this euler angle where components are the sum of this euler angle and the other one
Parameters
anglesThe other euler angle to add components with

◆ operator-()

template<typename T >
EulerAngles< T > Nz::EulerAngles< T >::operator- ( const EulerAngles< T > &  angles) const

Substracts the components of the euler angle with other euler angle.

Returns
A euler angle where components are the difference of this euler angle and the other one
Parameters
anglesThe other euler angle to substract components with

◆ operator-=()

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::operator-= ( const EulerAngles< T > &  angles)

Substracts the components of other euler angle to this euler angle.

Returns
A reference to this euler angle where components are the difference of this euler angle and the other one
Parameters
angleThe other euler angle to substract components with

◆ operator==()

template<typename T >
bool Nz::EulerAngles< T >::operator== ( const EulerAngles< T > &  angles) const

Compares the euler angle to other one.

Returns
true if the euler angles are the same
Parameters
anglesOther euler angle to compare with

◆ Set() [1/5]

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::Set ( P,
Y,
R 
)

Sets the components of the euler angle.

Returns
A reference to this euler angle
Parameters
PPitch component = X axis
YYaw component = Y axis
RRoll component = Z axis

◆ Set() [2/5]

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::Set ( const T  angles[3])

Sets the components of the euler angle from an array of three elements.

Returns
A reference to this euler angle
Parameters
angles[3]angles[0] is pitch component, angles[1] is yaw component and angles[2] is roll component

◆ Set() [3/5]

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::Set ( const EulerAngles< T > &  angles)

Sets the components of the euler angle from another euler angle.

Returns
A reference to this euler angle
Parameters
anglesThe other euler angle

◆ Set() [4/5]

template<typename T >
EulerAngles< T > & Nz::EulerAngles< T >::Set ( const Quaternion< T > &  quat)

Sets the components of the euler angle from a quaternion.

Returns
A reference to this euler angle
Parameters
quatQuaternion representing a rotation of space

◆ Set() [5/5]

template<typename T>
template<typename U >
EulerAngles<T>& Nz::EulerAngles< T >::Set ( const EulerAngles< U > &  angles)

Sets the components of the euler angle from another type of EulerAngles.

Returns
A reference to this euler angle
Parameters
anglesEulerAngles of type U to convert its components

◆ ToQuaternion()

template<typename T >
Quaternion< T > Nz::EulerAngles< T >::ToQuaternion ( ) const

Converts the euler angle to quaternion.

Returns
A Quaternion which represents the rotation of this euler angle

◆ ToString()

template<typename T >
String Nz::EulerAngles< T >::ToString ( ) const

Gives a string representation.

Returns
A string representation of the object: "EulerAngles(pitch, yaw, roll)"

◆ Zero()

template<typename T >
EulerAngles< T > Nz::EulerAngles< T >::Zero ( )
static

Shorthand for the euler angle (0, 0, 0)

Returns
A euler angle with components (0, 0, 0)
See also
MakeZero

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