A quaternion representing a rotation in 3d.
More...
|
| static Q | From (const AA &aa) |
| | Create a quaternion from an axis angle.
|
| static Q | From (const Ypr &ypr) |
| | Create a quaternion from a yaw-pitch-roll.
|
| static Q | From_Fast (const Ypr &ypr) |
| static Q | From_Rotation_Matrix (const m4 &m) |
| static Q | From_To (const Q &from, const Q &to) |
| | Create a quaternion going from from to to.
|
| static std::optional< Q > | Look_At (const v3 &from, const v3 &to, const n3 &up) |
| | Creates a look-at quaternion from 2 positions.
|
| static Q | Look_In_Direction (const n3 &dir, const n3 &up) |
| | Creates a look-at quaternion looking in a direction.
|
| static Q | Nlerp (const Q &f, float scale, const Q &t) |
| | Normalized lerp between 2 quaternions This will result in a non-linear rotation.
|
| static Q | Slerp_Fast (const Q &qa, float t, const Q &qb) |
| | Spherical lerp between 2 quaternions.
|
| static Q | Slerp (const Q &from, float scale, const Q &to) |
| | Shortest spherical lerp between 2 quaternions.
|
|
| float | w |
| float | x |
| float | y |
| float | z |
A quaternion representing a rotation in 3d.
Definition at line 18 of file quat.h.
◆ Q() [1/2]
| eu::Q::Q |
( |
float | aw, |
|
|
const v3 & | v ) |
|
inlineconstexpr |
◆ Q() [2/2]
| eu::Q::Q |
( |
const float * | arr | ) |
|
|
inlineconstexpr |
◆ From() [1/2]
| Q eu::Q::From |
( |
const AA & | aa | ) |
|
|
staticnodiscard |
Create a quaternion from an axis angle.
◆ From() [2/2]
| Q eu::Q::From |
( |
const Ypr & | ypr | ) |
|
|
staticnodiscard |
Create a quaternion from a yaw-pitch-roll.
◆ From_Fast()
| Q eu::Q::From_Fast |
( |
const Ypr & | ypr | ) |
|
|
staticnodiscard |
◆ From_Rotation_Matrix()
| Q eu::Q::From_Rotation_Matrix |
( |
const m4 & | m | ) |
|
|
staticnodiscard |
◆ From_To()
| Q eu::Q::From_To |
( |
const Q & | from, |
|
|
const Q & | to ) |
|
staticnodiscard |
Create a quaternion going from from to to.
◆ get_conjugate()
| Q eu::Q::get_conjugate |
( |
| ) |
const |
|
nodiscard |
Returns the conjugate of the quaternion.
◆ get_inverse()
| Q eu::Q::get_inverse |
( |
| ) |
const |
|
nodiscard |
Gets the inverse rotation.
Implemented as a conjugate with assert that the quaternion is normalized.
- See also
- get_conjugate()
◆ get_length()
| float eu::Q::get_length |
( |
| ) |
const |
|
nodiscard |
Gets the length of the quaternion.
Since the quaternion should be a unit, this should always be 1
◆ get_local_down()
| n3 eu::Q::get_local_down |
( |
| ) |
const |
|
nodiscard |
Get the local down vector.
◆ get_local_in()
| n3 eu::Q::get_local_in |
( |
| ) |
const |
|
nodiscard |
◆ get_local_left()
| n3 eu::Q::get_local_left |
( |
| ) |
const |
|
nodiscard |
Get the local left vector.
◆ get_local_out()
| n3 eu::Q::get_local_out |
( |
| ) |
const |
|
nodiscard |
Get the local out vector.
◆ get_local_right()
| n3 eu::Q::get_local_right |
( |
| ) |
const |
|
nodiscard |
Get the local right vector.
◆ get_local_up()
| n3 eu::Q::get_local_up |
( |
| ) |
const |
|
nodiscard |
◆ get_negated()
| Q eu::Q::get_negated |
( |
| ) |
const |
|
nodiscard |
Gets the negated quaternion.
The negated represents the same rotation
◆ get_normalized()
| Q eu::Q::get_normalized |
( |
| ) |
const |
|
nodiscard |
Return a normalized quaternion If it can't be normalized, the identity is returned.
◆ get_rotated()
| n3 eu::Q::get_rotated |
( |
const n3 & | v | ) |
const |
|
nodiscard |
Rotate a unit vector according to the quaternion.
◆ get_vec_part()
| v3 eu::Q::get_vec_part |
( |
| ) |
const |
|
nodiscard |
Get the [x,y,z] part as a regular 3d vector.
◆ Look_At()
| std::optional< Q > eu::Q::Look_At |
( |
const v3 & | from, |
|
|
const v3 & | to, |
|
|
const n3 & | up ) |
|
staticnodiscard |
Creates a look-at quaternion from 2 positions.
Standing at from and up is up, the result will be a quaternion looking at to
◆ Look_In_Direction()
| Q eu::Q::Look_In_Direction |
( |
const n3 & | dir, |
|
|
const n3 & | up ) |
|
staticnodiscard |
Creates a look-at quaternion looking in a direction.
◆ Nlerp()
| Q eu::Q::Nlerp |
( |
const Q & | f, |
|
|
float | scale, |
|
|
const Q & | t ) |
|
static |
Normalized lerp between 2 quaternions This will result in a non-linear rotation.
- See also
- slerp()
◆ normalize()
| void eu::Q::normalize |
( |
| ) |
|
Normalize the quaternion.
If it can't be normalized, it is set to the identity.
◆ operator*=() [1/2]
| void eu::Q::operator*= |
( |
const Q & | rhs | ) |
|
◆ operator*=() [2/2]
| void eu::Q::operator*= |
( |
float | rhs | ) |
|
◆ Slerp()
| Q eu::Q::Slerp |
( |
const Q & | from, |
|
|
float | scale, |
|
|
const Q & | to ) |
|
static |
Shortest spherical lerp between 2 quaternions.
Has extra logic to take the shortest route.
- See also
- slerp_fast()
-
nlerp()
◆ Slerp_Fast()
| Q eu::Q::Slerp_Fast |
( |
const Q & | qa, |
|
|
float | t, |
|
|
const Q & | qb ) |
|
static |
Spherical lerp between 2 quaternions.
Will take the longer route sometimes but is technically faster.
- See also
- nlerp()
◆ then_get_rotated()
| Q eu::Q::then_get_rotated |
( |
const Q & | q | ) |
const |
|
nodiscard |
Return the passed rotation composed after the current rotation.
The documentation for this struct was generated from the following file: