SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::Math::Vector< T, N > Class Template Reference

#include <Vector.hpp>

Inheritance diagram for Sleak::Math::Vector< T, N >:

Public Member Functions

constexpr Vector () noexcept
constexpr Vector (std::initializer_list< T > list)
template<size_t M = N>
std::enable_if< M==3, Vector< T, N > >::type Cross (const Vector< T, N > &other) const
Dot (const Vector< T, N > &other) const
Magnitude () const
void Normalize ()
Vector< T, N > Normalized () const
bool operator!= (const Vector< T, N > &other) const
Vector< T, N > operator* (T scalar) const
Vector< T, N > operator+ (const Vector< T, N > &other) const
Vector< T, N > & operator+= (const Vector< T, N > &other)
Vector< T, N > operator- (const Vector< T, N > &other) const
Vector< T, N > & operator-= (const Vector< T, N > &other)
Vector< T, N > operator/ (T scalar) const
bool operator== (const Vector< T, N > &other) const
T & operator[] (size_t index)
const T & operator[] (size_t index) const
T * ToRawArray ()
 Raw pointer to the backing N-element array.
std::string ToString () const

Friends

std::ostream & operator<< (std::ostream &os, const Vector< T, N > &v)

Detailed Description

template<typename T, size_t N>
class Sleak::Math::Vector< T, N >

Fixed-size numeric vector with the standard component-wise algebra. Vector2D/3D/4D wrap this for the common dimensions used engine-wide.

Definition at line 30 of file Vector.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<typename T, size_t N>
Sleak::Math::Vector< T, N >::Vector ( )
inlineconstexprnoexcept

Definition at line 33 of file Vector.hpp.

◆ Vector() [2/2]

template<typename T, size_t N>
Sleak::Math::Vector< T, N >::Vector ( std::initializer_list< T > list)
inlineconstexpr

Definition at line 35 of file Vector.hpp.

Member Function Documentation

◆ Cross()

template<typename T, size_t N>
template<size_t M = N>
std::enable_if< M==3, Vector< T, N > >::type Sleak::Math::Vector< T, N >::Cross ( const Vector< T, N > & other) const
inline

Definition at line 114 of file Vector.hpp.

◆ Dot()

template<typename T, size_t N>
T Sleak::Math::Vector< T, N >::Dot ( const Vector< T, N > & other) const
inline

Definition at line 103 of file Vector.hpp.

◆ Magnitude()

template<typename T, size_t N>
T Sleak::Math::Vector< T, N >::Magnitude ( ) const
inline

Definition at line 124 of file Vector.hpp.

◆ Normalize()

template<typename T, size_t N>
void Sleak::Math::Vector< T, N >::Normalize ( )
inline

Definition at line 133 of file Vector.hpp.

◆ Normalized()

template<typename T, size_t N>
Vector< T, N > Sleak::Math::Vector< T, N >::Normalized ( ) const
inline

Definition at line 144 of file Vector.hpp.

◆ operator!=()

template<typename T, size_t N>
bool Sleak::Math::Vector< T, N >::operator!= ( const Vector< T, N > & other) const
inline

Definition at line 161 of file Vector.hpp.

◆ operator*()

template<typename T, size_t N>
Vector< T, N > Sleak::Math::Vector< T, N >::operator* ( T scalar) const
inline

Definition at line 83 of file Vector.hpp.

◆ operator+()

template<typename T, size_t N>
Vector< T, N > Sleak::Math::Vector< T, N >::operator+ ( const Vector< T, N > & other) const
inline

Definition at line 57 of file Vector.hpp.

◆ operator+=()

template<typename T, size_t N>
Vector< T, N > & Sleak::Math::Vector< T, N >::operator+= ( const Vector< T, N > & other)
inline

Definition at line 71 of file Vector.hpp.

◆ operator-()

template<typename T, size_t N>
Vector< T, N > Sleak::Math::Vector< T, N >::operator- ( const Vector< T, N > & other) const
inline

Definition at line 64 of file Vector.hpp.

◆ operator-=()

template<typename T, size_t N>
Vector< T, N > & Sleak::Math::Vector< T, N >::operator-= ( const Vector< T, N > & other)
inline

Definition at line 77 of file Vector.hpp.

◆ operator/()

template<typename T, size_t N>
Vector< T, N > Sleak::Math::Vector< T, N >::operator/ ( T scalar) const
inline

Definition at line 91 of file Vector.hpp.

◆ operator==()

template<typename T, size_t N>
bool Sleak::Math::Vector< T, N >::operator== ( const Vector< T, N > & other) const
inline

Definition at line 151 of file Vector.hpp.

◆ operator[]() [1/2]

template<typename T, size_t N>
T & Sleak::Math::Vector< T, N >::operator[] ( size_t index)
inlinenodiscard

Definition at line 45 of file Vector.hpp.

◆ operator[]() [2/2]

template<typename T, size_t N>
const T & Sleak::Math::Vector< T, N >::operator[] ( size_t index) const
inlinenodiscard

Definition at line 51 of file Vector.hpp.

◆ ToRawArray()

template<typename T, size_t N>
T * Sleak::Math::Vector< T, N >::ToRawArray ( )
inline

Raw pointer to the backing N-element array.

Definition at line 178 of file Vector.hpp.

◆ ToString()

template<typename T, size_t N>
std::string Sleak::Math::Vector< T, N >::ToString ( ) const
inline

Definition at line 166 of file Vector.hpp.

◆ operator<<

template<typename T, size_t N>
std::ostream & operator<< ( std::ostream & os,
const Vector< T, N > & v )
friend

Definition at line 182 of file Vector.hpp.