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_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_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: