|
3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
|
A quaternion is a hyper-complex number that represents 3D rotations the same way 2D rotations can be represented by a complex number. More...
#include <Quaternion.hpp>
Public Member Functions | |
| constexpr | Quaternion (float x=0.0f, float y=0.0f, float z=0.0f, float w=1.0f) |
| constexpr | Quaternion (std::initializer_list< float > lst) |
| float | Length () const noexcept |
| Returns the length of the quaternion. The length is defined as the square root of the sum of the squares of its components. | |
| float | LengthSquared () const noexcept |
| Returns the lenght of this quaternion squared. | |
| Quaternion & | Normalize () |
| Quaternion & | Conjugate () noexcept |
| Quaternion & | Inverse () |
| Creates an inverse Quaternion. | |
| float | Dot (const Quaternion &q) const noexcept |
| Returns the dot Product between this quaternion and another quaternion. | |
| float & | Re () noexcept |
| Returns the real part of this quaternion. | |
| float | Re () const noexcept |
| Returns the real part of this quaternion. | |
| Vector3 | Im () const noexcept |
| Returns the imaginary component of this quaternion. | |
| Vector3 | ToYawPitchRoll () const |
| Converts this quaternion to yaw, pitch, and roll angles (in radians). | |
| Quaternion & | Hadamard (const Quaternion &q) |
| Element wise (Hadamard) multiplication of this quaternion with another quaternion. | |
| Quaternion & | operator- () noexcept |
| Negates this quaternion. | |
| Quaternion | operator+ (const Quaternion &q) const noexcept |
| Adds another quaternion to this quaternion and returns the result. | |
| Quaternion & | operator+= (const Quaternion &q) noexcept |
| Adds another quaternion to this quaternion in-place. | |
| Quaternion | operator- (const Quaternion &q) const noexcept |
| Subtracts another quaternion from this quaternion and returns the result. | |
| Quaternion & | operator-= (const Quaternion &q) noexcept |
| Subtracts another quaternion from this quaternion in-place. | |
| Quaternion | operator* (const Quaternion &q) const noexcept |
| Multiplies (composes) this quaternion by another quaternion and returns the result. | |
| Quaternion & | operator*= (const Quaternion &q) noexcept |
| Multiplies (composes) this quaternion by another quaternion in-place. | |
| Quaternion | operator* (float s) const noexcept |
| Multiplies this quaternion by a scalar and returns the result. | |
| Quaternion & | operator*= (float s) noexcept |
| Multiplies this quaternion by a scalar in-place. | |
| Quaternion | operator/ (float s) const |
| Divides this quaternion by a scalar and returns the result. | |
| Quaternion & | operator/= (float s) |
| Divides this quaternion by a scalar in-place. | |
| auto | operator<=> (const Quaternion &q) const noexcept=default |
| Partial ordering comparison between this quaternion and another quaternion. The comparison is based on the lexicographical order of the components (X, Y, Z, W). | |
Static Public Member Functions | |
| static Quaternion | FromYawPitchRoll (float yaw, float pitch, float roll) |
| static Quaternion | FromAxisAngle (const Vector3 &axis, float angle) |
| static Quaternion | FromMatrix (const Matrix4x4 &m) |
| static Quaternion | BetweenVectors (const Vector3 &a, const Vector3 &b) |
| static Quaternion | Slerp (const Quaternion &a, const Quaternion &b, float t) |
| static float | Dot (const Quaternion &a, const Quaternion &b) |
| Returns the dot product of two quaternions. | |
Public Attributes | |
| float | X |
| The X component of the quaternion. | |
| float | Y |
| The Y component of the quaternion. | |
| float | Z |
| The Z component of the quaternion. | |
| float | W |
| The real/scalar component of the quaternion. | |
A quaternion is a hyper-complex number that represents 3D rotations the same way 2D rotations can be represented by a complex number.
|
inlineexplicitconstexpr |
|
inlineexplicitconstexpr |
|
static |
|
noexcept |
|
static |
Returns the dot product of two quaternions.
| a | The first quaternion. |
| b | The second quaternion. |
|
noexcept |
Returns the dot Product between this quaternion and another quaternion.
| q | Other quaternion. |
|
static |
|
static |
|
static |
| Quaternion & Quaternion::Hadamard | ( | const Quaternion & | q | ) |
Element wise (Hadamard) multiplication of this quaternion with another quaternion.
| q | The quaternion to multiply element-wise. |
|
noexcept |
Returns the imaginary component of this quaternion.
| Quaternion & Quaternion::Inverse | ( | ) |
Creates an inverse Quaternion.
|
noexcept |
Returns the length of the quaternion. The length is defined as the square root of the sum of the squares of its components.
|
noexcept |
Returns the lenght of this quaternion squared.
| Quaternion & Quaternion::Normalize | ( | ) |
|
noexcept |
Multiplies (composes) this quaternion by another quaternion and returns the result.
| q | The quaternion to multiply by. |
|
noexcept |
Multiplies this quaternion by a scalar and returns the result.
| s | The scalar to multiply by. |
|
noexcept |
Multiplies (composes) this quaternion by another quaternion in-place.
| q | The quaternion to multiply by. |
|
noexcept |
Multiplies this quaternion by a scalar in-place.
| s | The scalar to multiply by. |
|
noexcept |
Adds another quaternion to this quaternion and returns the result.
| q | The quaternion to add. |
|
noexcept |
Adds another quaternion to this quaternion in-place.
| q | The quaternion to add. |
|
noexcept |
Negates this quaternion.
|
noexcept |
Subtracts another quaternion from this quaternion and returns the result.
| q | The quaternion to subtract. |
|
noexcept |
Subtracts another quaternion from this quaternion in-place.
| q | The quaternion to subtract. |
| Quaternion Quaternion::operator/ | ( | float | s | ) | const |
Divides this quaternion by a scalar and returns the result.
| s | The scalar to divide by. |
| Quaternion & Quaternion::operator/= | ( | float | s | ) |
Divides this quaternion by a scalar in-place.
| s | The scalar to divide by. |
|
defaultnoexcept |
Partial ordering comparison between this quaternion and another quaternion. The comparison is based on the lexicographical order of the components (X, Y, Z, W).
| q | The quaternion to compare with. |
|
noexcept |
Returns the real part of this quaternion.
|
noexcept |
Returns the real part of this quaternion.
|
static |
| Vector3 Quaternion::ToYawPitchRoll | ( | ) | const |
Converts this quaternion to yaw, pitch, and roll angles (in radians).
| float Engine3DRadSpace.Math::Quaternion::W |
The real/scalar component of the quaternion.
| float Engine3DRadSpace.Math::Quaternion::X |
The X component of the quaternion.
| float Engine3DRadSpace.Math::Quaternion::Y |
The Y component of the quaternion.
| float Engine3DRadSpace.Math::Quaternion::Z |
The Z component of the quaternion.