TeaPacket v0.0.1
Multiplatform Game Engine
Loading...
Searching...
No Matches
Vector.hpp File Reference
#include <algorithm>
#include <stdexcept>
#include <array>
#include <string>

Go to the source code of this file.

Classes

class  TeaPacket::Math::Vector< T, i >
 A template class for all base Vector types. More...
 

Namespaces

namespace  TeaPacket
 
namespace  TeaPacket::Math
 Math related functions and classes for TeaPacket.
 

Macros

#define TP_VEC_ALIAS(name, index)
 
#define TP_VEC_MATH_OPERATOR(OP)
 
#define TP_VECTOR_TYPE_GEN_SOLO(size, type, typeInitial)
 
#define TP_VECTOR_TYPE_GEN(vecsize)
 

Macro Definition Documentation

◆ TP_VEC_ALIAS

#define TP_VEC_ALIAS ( name,
index )
Value:
T& name() { return _values[index]; static_assert(index <= i, "Attempt to use an alias that doesn't exist for this TeaPacket Vector type! Alias index: " #index "." ); }; \
const T& name() const { return _values[index]; static_assert(index <= i, "Attempt to use an alias that doesn't exist for this TeaPacket Vector type! Alias index: " #index "."); }; \

◆ TP_VEC_MATH_OPERATOR

#define TP_VEC_MATH_OPERATOR ( OP)
Value:
template<unsigned char s> \
Vector<T,i>& operator OP##= (const Vector<T,s>& other) \
{ \
static_assert(i >= s, "Left side Vector must have a larger or equal size to the Right side Vector when performing math operations."); \
for(unsigned char j = 0; j < s; j++) \
{ \
this[j] OP##= other[j]; \
}\
return *this; \
} \
template<unsigned char s> \
Vector<T,i> operator OP (const Vector<T,s>& other) const \
{ \
static_assert(i >= s, "Left side Vector must have a larger or equal size to the Right side Vector when performing math operations."); \
Vector<T,i> vec = this; \
return vec OP##= other; \
}

◆ TP_VECTOR_TYPE_GEN

#define TP_VECTOR_TYPE_GEN ( vecsize)
Value:
TP_VECTOR_TYPE_GEN_SOLO(vecsize, float, ) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, float, f) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, double, d) \
\
TP_VECTOR_TYPE_GEN_SOLO(vecsize, signed char, sb) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, char, b) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, unsigned char, ub) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, short, s) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, signed short, ss) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, unsigned short, us) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, int, i) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, signed int, si) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, unsigned int, ui) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, long, l) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, signed long, sl) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, unsigned long, ul) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, long long, ll) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, signed long long, sll) \
TP_VECTOR_TYPE_GEN_SOLO(vecsize, unsigned long long, ull)
#define TP_VECTOR_TYPE_GEN_SOLO(size, type, typeInitial)
Definition Vector.hpp:140

◆ TP_VECTOR_TYPE_GEN_SOLO

#define TP_VECTOR_TYPE_GEN_SOLO ( size,
type,
typeInitial )
Value:
typedef TeaPacket::Math::Vector<type, size> Vector##size##typeInitial;
A template class for all base Vector types.
Definition Vector.hpp:37