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

Vector 4 Sapphire-Maths class. More...

#include <Vector4.hpp>

Public Types

using Type = T
 Type of the Vector.
 

Public Member Functions

 Vec4 ()=default
 Default constructor.
 
constexpr Vec4 (T _x, T _y, T _z, T _w) noexcept
 Value constructor.
 
constexpr Vec4 (T _scale) noexcept
 Scale Value constructor.
 
 Vec4 (Vec4 &&)=default
 Default move constructor.
 
 Vec4 (const Vec4 &)=default
 Default copy constructor.
 
template<typename TIn >
constexpr Vec4 (const Vec4< TIn > &_other) noexcept
 Value constructor from another Vec4 type.
 
template<typename TIn >
constexpr Vec4 (const Vec2< TIn > &_other, T _z=T(0), T _w=T(0)) noexcept
 Value constructor from Vec2.
 
template<typename TIn >
constexpr Vec4 (const Vec2< TIn > &_v1, const Vec2< TIn > &_v2) noexcept
 Value constructor from 2 Vec2.
 
template<typename TIn >
constexpr Vec4 (const Vec3< TIn > &_other, T _w=T(0)) noexcept
 Value constructor from Vec3.
 
constexpr bool IsZero () const noexcept
 Whether this vector is a zero vector.
 
constexpr bool Equals (const Vec4 &_other, T _epsilon=std::numeric_limits< T >::epsilon()) const noexcept
 Compare 2 vector.
 
constexpr bool operator== (const Vec4 &_rhs) const noexcept
 Compare 2 vector equality.
 
constexpr bool operator!= (const Vec4 &_rhs) const noexcept
 Compare 2 vector inequality.
 
T * Data () noexcept
 Getter of vector data
 
const T * Data () const noexcept
  Const Getter of vector data
 
T & operator[] (uint32_t _index)
 Access operator by index: x, y, z, w using 0, 1, 2, 3.
 
const T & operator[] (uint32_t _index) const
  Const Access operator by index: x, y, z,w using 0, 1, 2, 3.
 
Vec4operator= (Vec4 &&)=default
 Default assignment move operator.
 
Vec4operator= (const Vec4 &)=default
 Default assignment copy operator.
 

Public Attributes

x = T()
 Vector's X component (axis value).
 
y = T()
 Vector's Y component (axis value).
 
z = T()
 Vector's Z component (axis value).
 
w = T()
 Vector's W component (stored after xyz).
 

Detailed Description

template<typename T>
struct SA::Vec4< T >

Vector 4 Sapphire-Maths class.

Template Parameters
TType of the vector.

Constructor & Destructor Documentation

◆ Vec4() [1/6]

template<typename T >
constexpr SA::Vec4< T >::Vec4 ( T _x,
T _y,
T _z,
T _w )
constexprnoexcept

Value constructor.

Parameters
[in]_xX axis value.
[in]_yY axis value.
[in]_zZ axis value.
[in]_wW axis value.

◆ Vec4() [2/6]

template<typename T >
constexpr SA::Vec4< T >::Vec4 ( T _scale)
constexprnoexcept

Scale Value constructor.

Parameters
[in]_scaleAxis value to apply on all axis.

◆ Vec4() [3/6]

template<typename T >
template<typename TIn >
constexpr SA::Vec4< T >::Vec4 ( const Vec4< TIn > & _other)
constexprnoexcept

Value constructor from another Vec4 type.

Template Parameters
TInType of the input Vec3.
Parameters
[in]_otherVec4 to construct from.

◆ Vec4() [4/6]

template<typename T >
template<typename TIn >
constexpr SA::Vec4< T >::Vec4 ( const Vec2< TIn > & _other,
T _z = T(0),
T _w = T(0) )
constexprnoexcept

Value constructor from Vec2.

Template Parameters
TInType of the in Vec2.
Parameters
[in]_otherVec2 to construct from.
[in]_zZ axis value.
[in]_wW axis value.

◆ Vec4() [5/6]

template<typename T >
template<typename TIn >
constexpr SA::Vec4< T >::Vec4 ( const Vec2< TIn > & _v1,
const Vec2< TIn > & _v2 )
constexprnoexcept

Value constructor from 2 Vec2.

Template Parameters
TInType of the in Vec2.
Parameters
[in]_v1First Vec2 to construct from.
[in]_v2Second Vec2 to construct from.

◆ Vec4() [6/6]

template<typename T >
template<typename TIn >
constexpr SA::Vec4< T >::Vec4 ( const Vec3< TIn > & _other,
T _w = T(0) )
constexprnoexcept

Value constructor from Vec3.

Template Parameters
TInType of the in Vec3.
Parameters
[in]_otherVec4 to construct from.
[in]_wW axis value.

Member Function Documentation

◆ Data() [1/2]

template<typename T >
const T * SA::Vec4< T >::Data ( ) const
noexcept

Const Getter of vector data

Returns
this vector as a const T*.

◆ Data() [2/2]

template<typename T >
T * SA::Vec4< T >::Data ( )
noexcept

Getter of vector data

Returns
this vector as a T*.

◆ Equals()

template<typename T >
constexpr bool SA::Vec4< T >::Equals ( const Vec4< T > & _other,
T _epsilon = std::numeric_limits< T >::epsilon() ) const
constexprnoexcept

Compare 2 vector.

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

◆ IsZero()

template<typename T >
constexpr bool SA::Vec4< T >::IsZero ( ) const
constexprnoexcept

Whether this vector is a zero vector.

Returns
True if this is a zero vector.

◆ operator!=()

template<typename T >
constexpr bool SA::Vec4< T >::operator!= ( const Vec4< T > & _rhs) const
constexprnoexcept

Compare 2 vector inequality.

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

◆ operator=() [1/2]

template<typename T >
Vec4 & SA::Vec4< T >::operator= ( const Vec4< T > & )
default

Default assignment copy operator.

Returns
self vector assigned.

◆ operator=() [2/2]

template<typename T >
Vec4 & SA::Vec4< T >::operator= ( Vec4< T > && )
default

Default assignment move operator.

Returns
self vector assigned.

◆ operator==()

template<typename T >
constexpr bool SA::Vec4< T >::operator== ( const Vec4< T > & _rhs) const
constexprnoexcept

Compare 2 vector equality.

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

◆ operator[]() [1/2]

template<typename T >
T & SA::Vec4< T >::operator[] ( uint32_t _index)

Access operator by index: x, y, z, w using 0, 1, 2, 3.

Parameters
[in]_indexIndex to access.
Returns
T value at index.

◆ operator[]() [2/2]

template<typename T >
const T & SA::Vec4< T >::operator[] ( uint32_t _index) const

Const Access operator by index: x, y, z,w using 0, 1, 2, 3.

Parameters
[in]_indexIndex to access.
Returns
T value at index.

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