SA_Maths
Sapphire Suite's C++ Maths Library
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
SA::Tr< T, Args > Struct Template Reference

Transform Sapphire's class. More...

#include <Transform.hpp>

Inheritance diagram for SA::Tr< T, Args >:

Public Types

using Type = T
 Transform type alias.
 

Public Member Functions

bool IsZero () const noexcept
 Whether this transform is a zero transform.
 
bool IsIdentity () const noexcept
 Whether this transform is an identity transform.
 
bool Equals (const Tr &_other, T _epsilon=std::numeric_limits< T >::epsilon()) const noexcept
 Compare 2 transform.
 
bool operator== (const Tr &_rhs) const noexcept
 Compare 2 transform equality.
 
bool operator!= (const Tr &_rhs) const noexcept
 Compare 2 transform inequality.
 
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > Right (TrFunc _functor=TrFunc()) const
 Getter of right vector (X axis) of this transform.
 
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > Up (TrFunc _functor=TrFunc()) const
 Getter of up vector (Y axis) of this transform.
 
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > Forward (TrFunc _functor=TrFunc()) const
 Getter of forward vector (Z axis) of this transform.
 
template<typename TrFunc = TrTRSMatrixFunctor>
Mat4< T > Matrix (TrFunc _functor=TrFunc()) const noexcept
 Compute matrix from transform Use default TRS order application.
 
template<template< typename > typename... InArgs>
Tr operator* (const Tr< T, InArgs... > &_rhs) const
 Multiply transform to compute transformation.
 
template<template< typename > typename... InArgs>
Tr operator/ (const Tr< T, InArgs... > &_rhs) const
 Divide transform to compute inverse-transformation.
 
template<template< typename > typename... InArgs>
Troperator*= (const Tr< T, InArgs... > &_rhs)
 Multiply transform to compute transformation.
 
template<template< typename > typename... InArgs>
Troperator/= (const Tr< T, InArgs... > &_rhs)
 Divide transform to compute inverse-transformation.
 
template<typename TOut , template< typename > typename... ArgsOut>
 operator Tr< TOut, ArgsOut... > () const noexcept
 Cast operator into other Transf type.
 

Static Public Member Functions

template<template< typename > typename Comp>
static constexpr bool HasComponent () noexcept
 compile-time HasComponent.
 
static Tr Lerp (const Tr &_start, const Tr &_end, float _alpha) noexcept
  Clamped Lerp from _start to _end at _alpha.
 
static Tr LerpUnclamped (const Tr &_start, const Tr &_end, float _alpha) noexcept
  Unclamped Lerp from _start to _end at _alpha.
 

Detailed Description

template<typename T, template< typename > typename... Args>
struct SA::Tr< T, Args >

Transform Sapphire's class.

Template Parameters
TTransform type.
ArgsTransform component types.

Member Function Documentation

◆ Equals()

template<typename T , template< typename > typename... Args>
bool SA::Tr< T, Args >::Equals ( const Tr< T, Args > & _other,
T _epsilon = std::numeric_limits< T >::epsilon() ) const
noexcept

Compare 2 transform.

Parameters
[in]_otherOther transform to compare to.
[in]_epsilonEpsilon value for threshold comparison.
Returns
Whether this and _other are equal.

◆ Forward()

template<typename T , template< typename > typename... Args>
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > SA::Tr< T, Args >::Forward ( TrFunc _functor = TrFunc()) const

Getter of forward vector (Z axis) of this transform.

Returns
transformed forward vector normalized.

◆ HasComponent()

template<typename T , template< typename > typename... Args>
template<template< typename > typename Comp>
static constexpr bool SA::Tr< T, Args >::HasComponent ( )
staticconstexprnoexcept

compile-time HasComponent.

Template Parameters
CompTransform Component type
Returns
Wether this has 'Comp' component.

◆ IsIdentity()

template<typename T , template< typename > typename... Args>
bool SA::Tr< T, Args >::IsIdentity ( ) const
noexcept

Whether this transform is an identity transform.

Returns
True if this is an identity transform.

◆ IsZero()

template<typename T , template< typename > typename... Args>
bool SA::Tr< T, Args >::IsZero ( ) const
noexcept

Whether this transform is a zero transform.

Returns
True if this is a zero transform.

◆ Lerp()

template<typename T , template< typename > typename... Args>
static Tr SA::Tr< T, Args >::Lerp ( const Tr< T, Args > & _start,
const Tr< T, Args > & _end,
float _alpha )
staticnoexcept

Clamped Lerp from _start to _end at _alpha.

Reference: https://en.wikipedia.org/wiki/Linear_interpolation

Parameters
_startStarting point of the lerp.
_endEnding point of the lerp.
_alphaAlpha of the lerp.
Returns
interpolation between _start and _end. return _start when _alpha == 0.0f and _end when _alpha == 1.0f.

◆ LerpUnclamped()

template<typename T , template< typename > typename... Args>
static Tr SA::Tr< T, Args >::LerpUnclamped ( const Tr< T, Args > & _start,
const Tr< T, Args > & _end,
float _alpha )
staticnoexcept

Unclamped Lerp from _start to _end at _alpha.

Reference: https://en.wikipedia.org/wiki/Linear_interpolation

Parameters
_startStarting point of the lerp.
_endEnding point of the lerp.
_alphaAlpha of the lerp.
Returns
interpolation between _start and _end. return _start when _alpha == 0.0f and _end when _alpha == 1.0f.

◆ Matrix()

template<typename T , template< typename > typename... Args>
template<typename TrFunc = TrTRSMatrixFunctor>
Mat4< T > SA::Tr< T, Args >::Matrix ( TrFunc _functor = TrFunc()) const
noexcept

Compute matrix from transform Use default TRS order application.

Returns
transformation matrix.

◆ operator Tr< TOut, ArgsOut... >()

template<typename T , template< typename > typename... Args>
template<typename TOut , template< typename > typename... ArgsOut>
SA::Tr< T, Args >::operator Tr< TOut, ArgsOut... > ( ) const
noexcept

Cast operator into other Transf type.

Template Parameters
TOutType of the casted transform.
ArgsOutArgs Type of the casted transform.
Returns
Casted result.

◆ operator!=()

template<typename T , template< typename > typename... Args>
bool SA::Tr< T, Args >::operator!= ( const Tr< T, Args > & _rhs) const
noexcept

Compare 2 transform inequality.

Parameters
[in]_rhsOther transform to compare to.
Returns
Whether this and _rhs are non-equal.

◆ operator*()

template<typename T , template< typename > typename... Args>
template<template< typename > typename... InArgs>
Tr SA::Tr< T, Args >::operator* ( const Tr< T, InArgs... > & _rhs) const

Multiply transform to compute transformation.

Parameters
[in]_rhsTransform to multiply.
Returns
new transform result.

◆ operator*=()

template<typename T , template< typename > typename... Args>
template<template< typename > typename... InArgs>
Tr & SA::Tr< T, Args >::operator*= ( const Tr< T, InArgs... > & _rhs)

Multiply transform to compute transformation.

Parameters
[in]_rhsTransform to multiply.
Returns
self transform result.

◆ operator/()

template<typename T , template< typename > typename... Args>
template<template< typename > typename... InArgs>
Tr SA::Tr< T, Args >::operator/ ( const Tr< T, InArgs... > & _rhs) const

Divide transform to compute inverse-transformation.

Parameters
[in]_rhsTransform to divide.
Returns
new transform result.

◆ operator/=()

template<typename T , template< typename > typename... Args>
template<template< typename > typename... InArgs>
Tr & SA::Tr< T, Args >::operator/= ( const Tr< T, InArgs... > & _rhs)

Divide transform to compute inverse-transformation.

Parameters
[in]_rhsTransform to divide.
Returns
self transform result.

◆ operator==()

template<typename T , template< typename > typename... Args>
bool SA::Tr< T, Args >::operator== ( const Tr< T, Args > & _rhs) const
noexcept

Compare 2 transform equality.

Parameters
[in]_rhsOther transform to compare to.
Returns
Whether this and _rhs are equal.

◆ Right()

template<typename T , template< typename > typename... Args>
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > SA::Tr< T, Args >::Right ( TrFunc _functor = TrFunc()) const

Getter of right vector (X axis) of this transform.

Returns
transformed right vector normalized.

◆ Up()

template<typename T , template< typename > typename... Args>
template<typename TrFunc = TrRotateAxisFunctor>
Vec3< T > SA::Tr< T, Args >::Up ( TrFunc _functor = TrFunc()) const

Getter of up vector (Y axis) of this transform.

Returns
transformed up vector normalized.

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