25 constexpr Q(
float aw,
const v3& v)
34 [[nodiscard]]
static Q from(
const AA& aa);
106 static Q nlerp(
const Q& f,
float scale,
const Q& t);
123 float dot(
const Q& lhs,
const Q& rhs);
#define ADD_CATCH_FORMATTER_DEF(TYPE)
constexpr Q q_identity
The identity quaternion.
float dot(const Q &lhs, const Q &rhs)
An operator*(const An &lhs, float rhs)
std::string string_from(const An &a)
A quaternion representing a rotation in 3d.
static Q from_to(const Q &from, const Q &to)
Create a quaternion going from from to to.
void operator*=(float rhs)
n3 get_local_up() const
Get the local up vector.
n3 get_local_right() const
Get the local right vector.
Q get_negated() const
Gets the negated quaternion.
constexpr Q(float aw, const v3 &v)
float get_length() const
Gets the length of the quaternion.
v3 get_vec_part() const
Get the [x,y,z] part as a regular 3d vector.
void operator*=(const Q &rhs)
void normalize()
Normalize the quaternion.
Q then_get_rotated(const Q &q) const
Return the passed rotation composed after the current rotation.
static Q slerp(const Q &from, float scale, const Q &to)
Shortest spherical lerp between 2 quaternions.
Q get_conjugate() const
Returns the conjugate of the quaternion.
n3 get_local_down() const
Get the local down vector.
static Q look_in_direction(const n3 &dir, const n3 &up)
Creates a look-at quaternion looking in a direction.
n3 get_rotated(const n3 &v) const
Rotate a unit vector according to the quaternion.
n3 get_local_left() const
Get the local left vector.
static Q from(const AA &aa)
Create a quaternion from an axis angle.
static Q nlerp(const Q &f, float scale, const Q &t)
Normalized lerp between 2 quaternions This will result in a non-linear rotation.
n3 get_local_out() const
Get the local out vector.
static Q slerp_fast(const Q &qa, float t, const Q &qb)
Spherical lerp between 2 quaternions.
n3 get_local_in() const
Get the local in vector.
Q get_inverse() const
Gets the inverse rotation.
Q get_normalized() const
Return a normalized quaternion If it can't be normalized, the identity is returned.
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 from(const Ypr &ypr)
Create a quaternion from a yaw-pitch-roll.