SA_Maths
Sapphire Suite's C++ Maths Library
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
Classes | Typedefs | Functions
Quaternion.hpp File Reference

Quaternion type implementation. More...

#include <cstdint>
#include <SA/Maths/Debug.hpp>
#include <SA/Maths/Config.hpp>
#include <SA/Maths/Angle/Degree.hpp>
#include <SA/Maths/Algorithms/Cos.hpp>
#include <SA/Maths/Algorithms/Sin.hpp>
#include <SA/Maths/Algorithms/Tan.hpp>
#include <SA/Maths/Algorithms/Sqrt.hpp>
#include <SA/Maths/Algorithms/Lerp.hpp>
#include <SA/Maths/Algorithms/Equals.hpp>
#include <SA/Maths/Space/Quaternion.inl>

Go to the source code of this file.

Classes

struct  SA::Quat< T >
 Quaternion Sapphire-Maths class. More...
 

Typedefs

using SA::Quatf = Quat<float>
 Alias for float Quat.
 
using SA::Quatd = Quat<double>
 Alias for double Quat.
 
template<typename T >
using SA::Quaternion = Quat<T>
 Template alias of Quat.
 
using SA::Quaternionf = Quaternion<float>
 Alias for float Quaternion.
 
using SA::Quaterniond = Quaternion<double>
 Alias for double Quaternion.
 

Functions

template<typename T >
constexpr Quat< T > SA::operator* (typename std::remove_cv< T >::type _lhs, const Quat< T > &_rhs) noexcept
 Scale each quaternion components by _lhs.
 
template<typename T >
Quat< T > SA::operator/ (typename std::remove_cv< T >::type _lhs, const Quat< T > &_rhs)
  Inverse Scale each quaternion components by _lhs.
 
template<typename T >
constexpr Vec3< T > SA::operator* (const Vec3< T > &_lhs, const Quat< T > &_rhs) noexcept
 Rotate _lhs vector by _rhs quaternion.
 
template<typename T >
constexpr Vec3< T > SA::operator/ (const Vec3< T > &_lhs, const Quat< T > &_rhs) noexcept
  Inverse-Rotate _lhs vector by _rhs quaternion.
 

Detailed Description

Quaternion type implementation.

Function Documentation

◆ operator*() [1/2]

template<typename T >
constexpr Vec3< T > SA::operator* ( const Vec3< T > & _lhs,
const Quat< T > & _rhs )
constexprnoexcept

Rotate _lhs vector by _rhs quaternion.

Apply quaternion rotation to vector. Quaternion must be normalized.

Parameters
[in]_lhsVector to rotate.
[in]_rhsQuaternion used for rotation.
Returns
new rotated vector.

◆ operator*() [2/2]

template<typename T >
constexpr Quat< T > SA::operator* ( typename std::remove_cv< T >::type _lhs,
const Quat< T > & _rhs )
constexprnoexcept

Scale each quaternion components by _lhs.

Parameters
[in]_lhsScale value to apply on all axis.
[in]_rhsQuaternion to scale.
Returns
new vector scaled.

◆ operator/() [1/2]

template<typename T >
constexpr Vec3< T > SA::operator/ ( const Vec3< T > & _lhs,
const Quat< T > & _rhs )
constexprnoexcept

Inverse-Rotate _lhs vector by _rhs quaternion.

Apply quaternion rotation to vector. Quaternion must be normalized.

Parameters
[in]_lhsVector to rotate.
[in]_rhsQuaternion used for rotation.
Returns
new inverse-rotated vector.

◆ operator/() [2/2]

template<typename T >
Quat< T > SA::operator/ ( typename std::remove_cv< T >::type _lhs,
const Quat< T > & _rhs )

Inverse Scale each quaternion components by _lhs.

Parameters
[in]_lhsInverse scale value to apply on all axis.
[in]_rhsQuaternion to scale.
Returns
new quaternion inverse-scaled.