Berserk
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TVecN< T, N > Class Template Reference

Generic vector class for an N dimensional space base on type T. More...

#include <TVecN.hpp>

Public Member Functions

 TVecN () noexcept
 
 TVecN (T x)
 
 TVecN (T x, T y)
 
 TVecN (T x, T y, T z)
 
 TVecN (T x, T y, T z, T w)
 
template<uint32 M>
 TVecN (const TVecN< T, M > &v, T a)
 
 TVecN (const std::initializer_list< T > &list) noexcept
 
 TVecN (const TVecN &other) noexcept
 
 TVecN (TVecN &&other) noexcept
 
template<uint32 M>
 TVecN (const TVecN< T, M > &other) noexcept
 
TVecNoperator= (const TVecN &other)
 
TVecNoperator= (TVecN &&other) noexcept
 
TVecN operator+ (const TVecN &other) const
 
TVecN operator- (const TVecN &other) const
 
TVecN operator* (const TVecN &other) const
 
TVecN operator/ (const TVecN &other) const
 
TVecN operator+ (T a) const
 
TVecN operator- (T a) const
 
TVecN operator* (T a) const
 
TVecN operator/ (T a) const
 
TVecNoperator+= (const TVecN &other)
 
TVecNoperator-= (const TVecN &other)
 
TVecNoperator*= (const TVecN &other)
 
TVecNoperator/= (const TVecN &other)
 
TVecNoperator+= (T a)
 
TVecNoperator-= (T a)
 
TVecNoperator*= (T a)
 
TVecNoperator/= (T a)
 
TVecN operator- () const
 
bool operator<= (const TVecN &other) const
 
bool operator>= (const TVecN &other) const
 
bool operator< (const TVecN &other) const
 
bool operator> (const TVecN &other) const
 
bool operator== (const TVecN &other) const
 
bool operator!= (const TVecN &other) const
 
TVecN Abs () const
 
TVecN Pow (T factor) const
 
T Length2 () const
 
T Length () const
 
TVecN Normalized () const
 
TVecNNormalizeThis ()
 
TVecNZero ()
 
Crc32Hash Hash () const
 
T x () const
 
T y () const
 
T z () const
 
T w () const
 
Toperator[] (uint32 index)
 
const Toperator[] (uint32 index) const
 
TGetData ()
 
const TGetData () const
 

Static Public Member Functions

static T Distance2 (const TVecN &a, const TVecN &b)
 
static T Distance (const TVecN &a, const TVecN &b)
 
static T Dot (const TVecN &a, const TVecN &b)
 
static T Angle (const TVecN &a, const TVecN &b)
 
static TVecN Cross (const TVecN &a, const TVecN &b)
 
static T Triple (const TVecN &a, const TVecN &b, const TVecN &c)
 
static TVecN Lerp (float t, const TVecN &a, const TVecN &b)
 
static TVecN Slerp (T t, const TVecN &a, const TVecN &b)
 
static TVecN Slerp (T t, T ang, const TVecN &a, const TVecN &b)
 
static TVecN Min (const TVecN &a, const TVecN &b)
 
static TVecN Max (const TVecN &a, const TVecN &b)
 
static TVecN Clamp (const TVecN &t, const TVecN &left, const TVecN &right)
 
static TVecN AxisX ()
 
static TVecN AxisY ()
 
static TVecN AxisZ ()
 

Public Attributes

T values [N]
 

Detailed Description

template<typename T, uint32 N>
class TVecN< T, N >

Generic vector class for an N dimensional space base on type T.

Template Parameters
TType of values inside vector
NVector dimension value; must be > 0

Constructor & Destructor Documentation

◆ TVecN() [1/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( )
inlinenoexcept

◆ TVecN() [2/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( T  x)
inlineexplicit

◆ TVecN() [3/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( T  x,
T  y 
)
inline

◆ TVecN() [4/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( T  x,
T  y,
T  z 
)
inline

◆ TVecN() [5/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( T  x,
T  y,
T  z,
T  w 
)
inline

◆ TVecN() [6/10]

template<typename T , uint32 N>
template<uint32 M>
TVecN< T, N >::TVecN ( const TVecN< T, M > &  v,
T  a 
)
inline

◆ TVecN() [7/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( const std::initializer_list< T > &  list)
inlinenoexcept

◆ TVecN() [8/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( const TVecN< T, N > &  other)
inlinenoexcept

◆ TVecN() [9/10]

template<typename T , uint32 N>
TVecN< T, N >::TVecN ( TVecN< T, N > &&  other)
inlinenoexcept

◆ TVecN() [10/10]

template<typename T , uint32 N>
template<uint32 M>
TVecN< T, N >::TVecN ( const TVecN< T, M > &  other)
inlineexplicitnoexcept

Member Function Documentation

◆ Abs()

template<typename T , uint32 N>
TVecN TVecN< T, N >::Abs ( ) const
inline

◆ Angle()

template<typename T , uint32 N>
static T TVecN< T, N >::Angle ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ AxisX()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::AxisX ( )
inlinestatic

◆ AxisY()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::AxisY ( )
inlinestatic

◆ AxisZ()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::AxisZ ( )
inlinestatic

◆ Clamp()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Clamp ( const TVecN< T, N > &  t,
const TVecN< T, N > &  left,
const TVecN< T, N > &  right 
)
inlinestatic

◆ Cross()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Cross ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

Vector cross product

Warning
Defined only fir 3-dim vectors
Parameters
aInput vector
bInput vector
Returns
Vector c, which satisfies: (a, b, c) - its right three

◆ Distance()

template<typename T , uint32 N>
static T TVecN< T, N >::Distance ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Distance2()

template<typename T , uint32 N>
static T TVecN< T, N >::Distance2 ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Dot()

template<typename T , uint32 N>
static T TVecN< T, N >::Dot ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ GetData() [1/2]

template<typename T , uint32 N>
T* TVecN< T, N >::GetData ( )
inline

◆ GetData() [2/2]

template<typename T , uint32 N>
const T* TVecN< T, N >::GetData ( ) const
inline

◆ Hash()

template<typename T , uint32 N>
Crc32Hash TVecN< T, N >::Hash ( ) const
inline

◆ Length()

template<typename T , uint32 N>
T TVecN< T, N >::Length ( ) const
inline

◆ Length2()

template<typename T , uint32 N>
T TVecN< T, N >::Length2 ( ) const
inline

◆ Lerp()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Lerp ( float  t,
const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Max()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Max ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Min()

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Min ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Normalized()

template<typename T , uint32 N>
TVecN TVecN< T, N >::Normalized ( ) const
inline

◆ NormalizeThis()

template<typename T , uint32 N>
TVecN& TVecN< T, N >::NormalizeThis ( )
inline

◆ operator!=()

template<typename T , uint32 N>
bool TVecN< T, N >::operator!= ( const TVecN< T, N > &  other) const
inline

◆ operator*() [1/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator* ( const TVecN< T, N > &  other) const
inline

◆ operator*() [2/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator* ( T  a) const
inline

◆ operator*=() [1/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator*= ( const TVecN< T, N > &  other)
inline

◆ operator*=() [2/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator*= ( T  a)
inline

◆ operator+() [1/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator+ ( const TVecN< T, N > &  other) const
inline

◆ operator+() [2/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator+ ( T  a) const
inline

◆ operator+=() [1/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator+= ( const TVecN< T, N > &  other)
inline

◆ operator+=() [2/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator+= ( T  a)
inline

◆ operator-() [1/3]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator- ( ) const
inline

◆ operator-() [2/3]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator- ( const TVecN< T, N > &  other) const
inline

◆ operator-() [3/3]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator- ( T  a) const
inline

◆ operator-=() [1/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator-= ( const TVecN< T, N > &  other)
inline

◆ operator-=() [2/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator-= ( T  a)
inline

◆ operator/() [1/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator/ ( const TVecN< T, N > &  other) const
inline

◆ operator/() [2/2]

template<typename T , uint32 N>
TVecN TVecN< T, N >::operator/ ( T  a) const
inline

◆ operator/=() [1/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator/= ( const TVecN< T, N > &  other)
inline

◆ operator/=() [2/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator/= ( T  a)
inline

◆ operator<()

template<typename T , uint32 N>
bool TVecN< T, N >::operator< ( const TVecN< T, N > &  other) const
inline

◆ operator<=()

template<typename T , uint32 N>
bool TVecN< T, N >::operator<= ( const TVecN< T, N > &  other) const
inline

◆ operator=() [1/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator= ( const TVecN< T, N > &  other)
inline

◆ operator=() [2/2]

template<typename T , uint32 N>
TVecN& TVecN< T, N >::operator= ( TVecN< T, N > &&  other)
inlinenoexcept

◆ operator==()

template<typename T , uint32 N>
bool TVecN< T, N >::operator== ( const TVecN< T, N > &  other) const
inline

◆ operator>()

template<typename T , uint32 N>
bool TVecN< T, N >::operator> ( const TVecN< T, N > &  other) const
inline

◆ operator>=()

template<typename T , uint32 N>
bool TVecN< T, N >::operator>= ( const TVecN< T, N > &  other) const
inline

◆ operator[]() [1/2]

template<typename T , uint32 N>
T& TVecN< T, N >::operator[] ( uint32  index)
inline

◆ operator[]() [2/2]

template<typename T , uint32 N>
const T& TVecN< T, N >::operator[] ( uint32  index) const
inline

◆ Pow()

template<typename T , uint32 N>
TVecN TVecN< T, N >::Pow ( T  factor) const
inline

◆ Slerp() [1/2]

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Slerp ( T  t,
const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Slerp() [2/2]

template<typename T , uint32 N>
static TVecN TVecN< T, N >::Slerp ( T  t,
T  ang,
const TVecN< T, N > &  a,
const TVecN< T, N > &  b 
)
inlinestatic

◆ Triple()

template<typename T , uint32 N>
static T TVecN< T, N >::Triple ( const TVecN< T, N > &  a,
const TVecN< T, N > &  b,
const TVecN< T, N > &  c 
)
inlinestatic

Triple vector product - volume of the a figure with sign: Positive volume if (a,b,c) - right-system three

Parameters
aInput vector
bInput vector
cInput vector
Returns
Signed volume

◆ w()

template<typename T , uint32 N>
T TVecN< T, N >::w ( ) const
inline

◆ x()

template<typename T , uint32 N>
T TVecN< T, N >::x ( ) const
inline

◆ y()

template<typename T , uint32 N>
T TVecN< T, N >::y ( ) const
inline

◆ z()

template<typename T , uint32 N>
T TVecN< T, N >::z ( ) const
inline

◆ Zero()

template<typename T , uint32 N>
TVecN& TVecN< T, N >::Zero ( )
inline

Member Data Documentation

◆ values

template<typename T , uint32 N>
T TVecN< T, N >::values[N]

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