sandbox
Loading...
Searching...
No Matches
sbx::math::basic_quaternion< Type > Class Template Reference

Public Types

using value_type = Type
 
using reference = value_type &
 
using const_reference = const value_type &
 
using size_type = std::size_t
 
using length_type = std::float_t
 
using vector_type = vector_type_for< value_type >
 
using matrix_type = matrix_type_for< value_type >
 
using angle_type = basic_angle< value_type >
 

Public Member Functions

template<floating_point Other = value_type>
constexpr basic_quaternion (Other value=Other{0}) noexcept
 
template<floating_point Complex = value_type, floating_point Scalar = value_type>
constexpr basic_quaternion (const vector_type_for< Complex > &complex, Scalar scalar) noexcept
 
template<floating_point Other = value_type>
constexpr basic_quaternion (const vector_type_for< Other > &euler_angles) noexcept
 
template<floating_point Other = value_type>
constexpr basic_quaternion (Other x, Other y, Other z, Other w) noexcept
 
template<floating_point Complex = value_type, floating_point Scalar = value_type>
constexpr basic_quaternion (const vector_type_for< Complex > &axis, const basic_angle< Scalar > &angle) noexcept
 
template<floating_point Other = value_type>
constexpr basic_quaternion (const matrix_type_for< Other > &matrix) noexcept
 
constexpr operator matrix_type () const noexcept
 
constexpr auto to_matrix () const noexcept -> matrix_type
 
template<floating_point Other = value_type>
constexpr auto operator+= (const basic_quaternion< Other > &other) noexcept -> basic_quaternion &
 
template<floating_point Other = value_type>
constexpr auto operator-= (const basic_quaternion< Other > &other) noexcept -> basic_quaternion &
 
template<floating_point Other = value_type>
constexpr auto operator*= (Other value) noexcept -> basic_quaternion &
 
template<floating_point Other = value_type>
constexpr auto operator*= (const basic_quaternion< Other > &other) noexcept -> basic_quaternion &
 
template<floating_point Other = value_type>
constexpr auto operator/= (Other value) noexcept -> basic_quaternion &
 
constexpr auto x () noexcept -> reference
 
constexpr auto x () const noexcept -> const_reference
 
constexpr auto y () noexcept -> reference
 
constexpr auto y () const noexcept -> const_reference
 
constexpr auto z () noexcept -> reference
 
constexpr auto z () const noexcept -> const_reference
 
constexpr auto w () noexcept -> reference
 
constexpr auto w () const noexcept -> const_reference
 
constexpr auto complex () noexcept -> vector_type &
 
constexpr auto complex () const noexcept -> const vector_type &
 
constexpr auto scalar () noexcept -> reference
 
constexpr auto scalar () const noexcept -> const_reference
 
constexpr auto length_squared () const noexcept -> length_type
 
constexpr auto length () const noexcept -> length_type
 
constexpr auto normalize () noexcept -> basic_quaternion &
 

Static Public Member Functions

template<floating_point Other = value_type>
static constexpr auto wxyz (Other w, Other x, Other y, Other z) noexcept -> basic_quaternion
 
static constexpr auto normalized (const basic_quaternion &quaternion) noexcept -> basic_quaternion
 
static constexpr auto dot (const basic_quaternion &lhs, const basic_quaternion &rhs) noexcept -> value_type
 
static constexpr auto lerp (const basic_quaternion &start, const basic_quaternion &end, const value_type t) noexcept -> basic_quaternion
 
static constexpr auto slerp (const basic_quaternion &x, basic_quaternion y, const value_type a) noexcept -> basic_quaternion
 Spherical linear interpolation between two quaternions. More...
 

Static Public Attributes

static constexpr basic_quaternion identity {vector_type::zero, value_type{1}}
 

Member Function Documentation

◆ slerp()

template<floating_point Type>
static constexpr auto sbx::math::basic_quaternion< Type >::slerp ( const basic_quaternion< Type > &  x,
basic_quaternion< Type >  y,
const value_type  a 
) -> basic_quaternion
inlinestaticconstexprnoexcept

Spherical linear interpolation between two quaternions.

Parameters
startThe starting quaternion.
endThe ending quaternion.
tThe interpolation factor [0.0f, 1.0f].
Returns
A new quaternion that is the result of the spherical linear interpolation.

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