Namespaces

VecOps.h File Reference

#include <gmtl/Defines.h>
#include <gmtl/Math.h>
#include <gmtl/Vec.h>
#include <gmtl/VecOpsMeta.h>
#include <gmtl/VecExprMeta.h>
Include dependency graph for VecOps.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  gmtl
 

Meta programming classes.


Functions

Vector/Point Operations

template<typename T , unsigned SIZE, typename R1 >
VecBase< T, SIZE,
meta::VecUnaryExpr< VecBase< T,
SIZE, R1 >, meta::VecNegUnary > > 
gmtl::operator- (const VecBase< T, SIZE, R1 > &v1)
 Negates v1.
template<class DATA_TYPE , unsigned SIZE, typename REP2 >
VecBase< DATA_TYPE, SIZE > & gmtl::operator+= (VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE, REP2 > &v2)
 Adds v2 to v1 and stores the result in v1.
template<typename T , unsigned SIZE, typename R1 , typename R2 >
VecBase< T, SIZE,
meta::VecBinaryExpr< VecBase
< T, SIZE, R1 >, VecBase< T,
SIZE, R2 >
, meta::VecPlusBinary > > 
gmtl::operator+ (const VecBase< T, SIZE, R1 > &v1, const VecBase< T, SIZE, R2 > &v2)
 Adds v2 to v1 and returns the result.
template<class DATA_TYPE , unsigned SIZE, typename REP2 >
VecBase< DATA_TYPE, SIZE > & gmtl::operator-= (VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE, REP2 > &v2)
 Subtracts v2 from v1 and stores the result in v1.
template<typename T , unsigned SIZE, typename R1 , typename R2 >
VecBase< T, SIZE,
meta::VecBinaryExpr< VecBase
< T, SIZE, R1 >, VecBase< T,
SIZE, R2 >
, meta::VecMinusBinary > > 
gmtl::operator- (const VecBase< T, SIZE, R1 > &v1, const VecBase< T, SIZE, R2 > &v2)
 Subtracts v2 from v1 and returns the result.
template<class DATA_TYPE , unsigned SIZE, class SCALAR_TYPE >
VecBase< DATA_TYPE, SIZE > & gmtl::operator*= (VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Multiplies v1 by a scalar value and stores the result in v1.
template<typename T , unsigned SIZE, typename R1 >
VecBase< T, SIZE,
meta::VecBinaryExpr< VecBase
< T, SIZE, R1 >, VecBase< T,
SIZE, meta::ScalarArg< T >
>, meta::VecMultBinary > > 
gmtl::operator* (const VecBase< T, SIZE, R1 > &v1, const T scalar)
 Multiplies v1 by a scalar value and returns the result.
template<typename T , unsigned SIZE, typename R1 >
VecBase< T, SIZE,
meta::VecBinaryExpr< VecBase
< T, SIZE, meta::ScalarArg< T >
>, VecBase< T, SIZE, R1 >
, meta::VecMultBinary > > 
gmtl::operator* (const T scalar, const VecBase< T, SIZE, R1 > &v1)
template<class DATA_TYPE , unsigned SIZE, class SCALAR_TYPE >
VecBase< DATA_TYPE, SIZE > & gmtl::operator/= (VecBase< DATA_TYPE, SIZE > &v1, const SCALAR_TYPE &scalar)
 Multiplies v1 by a scalar value and returns the result.
template<typename T , unsigned SIZE, typename R1 >
VecBase< T, SIZE,
meta::VecBinaryExpr< VecBase
< T, SIZE, R1 >, VecBase< T,
SIZE, meta::ScalarArg< T >
>, meta::VecDivBinary > > 
gmtl::operator/ (const VecBase< T, SIZE, R1 > &v1, const T scalar)
 Divides v1 by a scalar value and returns the result.
Vector Operations

template<class DATA_TYPE , unsigned SIZE, typename REP1 , typename REP2 >
DATA_TYPE gmtl::dot (const VecBase< DATA_TYPE, SIZE, REP1 > &v1, const VecBase< DATA_TYPE, SIZE, REP2 > &v2)
 Computes dot product of v1 and v2 and returns the result.
template<class DATA_TYPE , unsigned SIZE>
DATA_TYPE gmtl::length (const Vec< DATA_TYPE, SIZE > &v1)
 Computes the length of the given vector.
template<class DATA_TYPE , unsigned SIZE>
DATA_TYPE gmtl::lengthSquared (const Vec< DATA_TYPE, SIZE > &v1)
 Computes the square of the length of the given vector.
template<class DATA_TYPE , unsigned SIZE>
DATA_TYPE gmtl::normalize (Vec< DATA_TYPE, SIZE > &v1)
 Normalizes the given vector in place causing it to be of unit length.
template<class DATA_TYPE , unsigned SIZE>
bool gmtl::isNormalized (const Vec< DATA_TYPE, SIZE > &v1, const DATA_TYPE eps=(DATA_TYPE) 0.0001f)
 Determines if the given vector is normalized within the given tolerance.
template<class DATA_TYPE >
Vec< DATA_TYPE, 3 > & gmtl::cross (Vec< DATA_TYPE, 3 > &result, const Vec< DATA_TYPE, 3 > &v1, const Vec< DATA_TYPE, 3 > &v2)
 Computes the cross product between v1 and v2 and stores the result in result.
template<class DATA_TYPE , unsigned SIZE>
VecBase< DATA_TYPE, SIZE > & gmtl::reflect (VecBase< DATA_TYPE, SIZE > &result, const VecBase< DATA_TYPE, SIZE > &vec, const Vec< DATA_TYPE, SIZE > &normal)
 Reflect a vector about a normal.
Vector Interpolation

template<typename DATA_TYPE , unsigned SIZE>
VecBase< DATA_TYPE, SIZE > & gmtl::lerp (VecBase< DATA_TYPE, SIZE > &result, const DATA_TYPE &lerpVal, const VecBase< DATA_TYPE, SIZE > &from, const VecBase< DATA_TYPE, SIZE > &to)
 Linearly interpolates between to vectors.
Vector Comparitors

template<class DATA_TYPE , unsigned SIZE>
bool gmtl::operator== (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Compares v1 and v2 to see if they are exactly the same.
template<class DATA_TYPE , unsigned SIZE>
bool gmtl::operator!= (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2)
 Compares v1 and v2 to see if they are NOT exactly the same with zero tolerance.
template<class DATA_TYPE , unsigned SIZE>
bool gmtl::isEqual (const VecBase< DATA_TYPE, SIZE > &v1, const VecBase< DATA_TYPE, SIZE > &v2, const DATA_TYPE eps)
 Compares v1 and v2 to see if they are the same within the given epsilon tolerance.