philsupertramp/game-math
Loading...
Searching...
No Matches
Namespaces | Functions
utils.h File Reference
#include "mat/mat2.h"
#include "mat/mat3.h"
#include "mat/mat4.h"
#include "vec/vec2.h"
#include "vec/vec3.h"
#include "vec/vec4.h"

Go to the source code of this file.

Namespaces

namespace  Math
 
namespace  Math::Utils
 

Functions

template<class V >
float Math::Utils::distance (const V &a, const V &b)
 
template<class T >
vec2< T > Math::Utils::normalize (const vec2< T > &a)
 
template<class T >
vec3< T > Math::Utils::normalize (const vec3< T > &a)
 
template<class T >
vec4< T > Math::Utils::normalize (const vec4< T > &a)
 
template<class T >
mat4< T > Math::Utils::translate (const mat4< T > &M, const vec3< T > &V)
 
template<class T >
mat4< T > Math::Utils::lookAt (const vec3< T > &eye, const vec3< T > &center, const vec3< T > &up)
 
template<class T >
mat4< T > Math::Utils::ortho (const float &left, const float &right, const float &bottom, const float &top)
 
template<class T >
mat4< T > Math::Utils::perspective (const float &FOV, const float &width, const float &height, const float &zNear, const float &zFar)
 
template<class T >
mat4< T > Math::Utils::angleAxis (const float &angle, const vec3< T > &axis)
 
template<class T >
mat4< T > Math::Utils::scale (const mat4< T > &mat, const float &factor)
 
template<class T >
mat4< T > Math::Utils::scale (const mat4< T > &mat, const vec3< T > &factor)
 
template<typename T , typename U >
vec3< T > Math::Utils::unProject (vec3< T > const &win, mat4< T > const &model, mat4< T > const &proj, vec4< U > const &viewport)
 
template<class T >
mat4< T > Math::Utils::rotate (const mat4< T > &m, const float &angle, vec3< T > u)
 
template<class T >
vec3< T > Math::Utils::max (const vec3< T > &a, const vec3< T > &b)
 
template<class T >
vec3< T > Math::Utils::lerp (const vec3< T > &p1, const vec3< T > &p2, const float &v)
 
template<class T >
vec4< T > Math::Utils::lerp (const vec4< T > &p1, const vec4< T > &p2, const float &v)
 
template<class T >
void * value_ptr (vec2< T > &vec)
 
template<class T >
void * value_ptr (vec3< T > &vec)
 
template<class T >
void * value_ptr (vec4< T > &vec)
 
template<class T >
void * value_ptr (mat2< T > &mat)
 
template<class T >
void * value_ptr (mat3< T > &mat)
 
template<class T >
void * value_ptr (mat4< T > &mat)
 
template<class T >
const void * value_ptr (vec2< T > const &vec)
 
template<class T >
const void * value_ptr (vec3< T > const &vec)
 
template<class T >
const void * value_ptr (vec4< T > const &vec)
 
template<class T >
const void * value_ptr (mat2< T > const &mat)
 
template<class T >
const void * value_ptr (mat3< T > const &mat)
 
template<class T >
const void * value_ptr (mat4< T > const &mat)
 
template<class T >
sign (const T &d)
 
template<class T >
abs (const T &d)
 

Detailed Description

Utility functions for 2,3,4-D vectors/matrices.

This header file holds all sorts of helper functions used in computer-graphics to manipulate 2,3,4-D objects.

Function Documentation

◆ abs()

template<class T >
T abs ( const T &  d)

Absolute value of given value. $f(x) = |x|$

Template Parameters
Tdatatype of input value
Parameters
dinput value
Returns
|d|
Examples
TestUtils.cpp, and statistics/TestProbability.cpp.

◆ sign()

template<class T >
T sign ( const T &  d)

Calculates sign(d)

Parameters
dvalue to test
Returns
-1 if d < 0 else 1
Examples
TestUtils.cpp.

◆ value_ptr() [1/12]

template<class T >
void * value_ptr ( mat2< T > &  mat)

cast from mat2 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [2/12]

template<class T >
const void * value_ptr ( mat2< T > const &  mat)

cast from const mat2 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [3/12]

template<class T >
void * value_ptr ( mat3< T > &  mat)

cast from mat3 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [4/12]

template<class T >
const void * value_ptr ( mat3< T > const &  mat)

cast from const mat3 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [5/12]

template<class T >
void * value_ptr ( mat4< T > &  mat)

cast from mat4 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [6/12]

template<class T >
const void * value_ptr ( mat4< T > const &  mat)

cast from mat3 to void*

Template Parameters
T
Parameters
mat
Returns

◆ value_ptr() [7/12]

template<class T >
void * value_ptr ( vec2< T > &  vec)

cast from vec2 to void*

Template Parameters
T
Parameters
vec
Returns
Examples
TestUtils.cpp.

◆ value_ptr() [8/12]

template<class T >
const void * value_ptr ( vec2< T > const &  vec)

cast from const vec2 to void*

Template Parameters
T
Parameters
vec
Returns

◆ value_ptr() [9/12]

template<class T >
void * value_ptr ( vec3< T > &  vec)

cast from vec3 to void*

Template Parameters
T
Parameters
vec
Returns

◆ value_ptr() [10/12]

template<class T >
const void * value_ptr ( vec3< T > const &  vec)

cast from const vec3 to void*

Template Parameters
T
Parameters
vec
Returns

◆ value_ptr() [11/12]

template<class T >
void * value_ptr ( vec4< T > &  vec)

cast from vec4 to void*

Template Parameters
T
Parameters
vec
Returns

◆ value_ptr() [12/12]

template<class T >
const void * value_ptr ( vec4< T > const &  vec)

cast from const vec4 to void*

Template Parameters
T
Parameters
vec
Returns