philsupertramp/game-math
|
#include <vec4.h>
Public Member Functions | |
vec4 () | |
vec4 (const T &_x, const T &_y, const T &_z, const T &_w) | |
vec4 (const T &v) | |
vec4 (const T *v) | |
vec4 (const vec4< T > &v) | |
template<typename V > | |
vec4 (const V &v, const T &_w) | |
float | length () const |
vec4< T > | normalize () const |
T | sum () const |
vec4< T > & | operator+= (const vec4< T > &rhs) |
vec4< T > & | operator-= (const vec4< T > &rhs) |
vec4< T > & | operator*= (const T &rhs) |
vec4< T > & | operator/= (const T &rhs) |
constexpr vec4< T > & | operator= (vec4< T > const &V) |
T & | operator[] (const int &index) |
const T & | operator[] (const int &index) const |
template<typename U > | |
operator vec4< U > () | |
Public Attributes | ||
union { | ||
struct { | ||
T x | ||
T y | ||
T z | ||
T w | ||
} | ||
}; | ||
representation of packed data | ||
const size_t | dim = 4 | |
dimension of object | ||
Friends | |
vec4< T > | operator+ (vec4< T > lhs, const vec4< T > &rhs) |
vec4< T > | operator- (vec4< T > lhs, const vec4< T > &rhs) |
vec4< T > | operator* (vec4< T > lhs, const T &rhs) |
vec4< T > | operator* (const T &lhs, vec4< T > rhs) |
vec4< T > | operator* (vec4< T > lhs, const vec4< T > &rhs) |
vec4< T > | operator/ (vec4< T > lhs, const T &rhs) |
bool | operator== (const vec4< T > &lhs, const vec4< T > &rhs) |
template<class U > | |
std::ostream & | operator<< (std::ostream &, const vec4< U > &) |
empty constructor initializes object with element value 0
4-element constructor
_x | |
_y | |
_z | |
_w |
data array constructor
v |
Getter for normalized vector
cast operator into new type
U |
vector-scalar multiplication
rhs |
vector-vector addition
rhs |
vector-vector subtraction
rhs |
vector-scalar division
rhs |
const copy constructor
V |
element access
index |
const element access
index |
scalar-vector multiplication
lhs | |
rhs |
vector-constant multiplication
lhs | |
rhs |
Dot product implementation
lhs | |
rhs |
vector-vector addition
lhs | |
rhs |
vector-vector subtraction
lhs | |
rhs |
vector-scalar division
lhs | |
rhs |
beautified std::cout operator
U |
equality comparison
lhs | |
rhs |