MathFu
An open source project by FPL.
 All Classes Namespaces Files Functions Variables Typedefs Friends Groups Pages
vector.h File Reference

Vector class and functions. More...

Go to the source code of this file.

Detailed Description

Vector class and functions.

Vector

Classes

class  mathfu::Vector< T, d >
 Vector of d elements with type T. More...
 
class  mathfu::VectorPacked< T, d >
 Packed N-dimensional vector. More...
 
class  mathfu::Vector< T, d >
 Vector of d elements with type T. More...
 

Namespaces

 mathfu
 Namespace for MathFu library.
 

Functions

template<class T , int d>
bool mathfu::operator== (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Compare 2 Vectors of the same size for equality. More...
 
template<class T , int d>
bool mathfu::operator!= (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Compare 2 Vectors of the same size for inequality. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator- (const Vector< T, d > &v)
 Negate all elements of the Vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator* (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Multiply a vector by another Vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator/ (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Divide a vector by another Vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator+ (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Add a vector with another Vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator- (const Vector< T, d > &lhs, const Vector< T, d > &rhs)
 subtract a vector with another Vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator* (const Vector< T, d > &v, const T &s)
 Multiply a vector with a scalar. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator+ (const Vector< T, d > &v, const T &s)
 Add a scalar to all elements of a vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::operator- (const Vector< T, d > &v, const T &s)
 Subtract a scalar from all elements of a vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator*= (Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Multiply (in-place) a vector with another Vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator/= (Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Divide (in-place) a vector by another Vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator+= (Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Add (in-place) a vector with another Vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator-= (Vector< T, d > &lhs, const Vector< T, d > &rhs)
 Subtract (in-place) another Vector from a vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator*= (Vector< T, d > &v, const T &s)
 Multiply (in-place) each element of a vector with a scalar. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator/= (Vector< T, d > &v, const T &s)
 Divide (in-place) each element of a vector by a scalar. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator+= (Vector< T, d > &v, const T &s)
 Add (in-place) a scalar to each element of a vector. More...
 
template<class T , int d>
Vector< T, d > & mathfu::operator-= (Vector< T, d > &v, const T &s)
 Subtract (in-place) a scalar from each element of a vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::HadamardProductHelper (const Vector< T, d > &v1, const Vector< T, d > &v2)
 Calculate the hadamard or componentwise product of two vectors. More...
 
template<class T >
Vector< T, 3 > mathfu::CrossProductHelper (const Vector< T, 3 > &v1, const Vector< T, 3 > &v2)
 Calculate the cross product of two vectors. More...
 
template<class T , int d>
mathfu::LengthSquaredHelper (const Vector< T, d > &v)
 Calculate the squared length of a vector. More...
 
template<class T , int d>
mathfu::LengthHelper (const Vector< T, d > &v)
 Calculate the length of a vector. More...
 
template<class T , int d>
mathfu::NormalizeHelper (Vector< T, d > &v)
 Normalize a vector in-place. More...
 
template<class T , int d>
Vector< T, d > mathfu::NormalizedHelper (const Vector< T, d > &v)
 Calculate the normalized version of a vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::LerpHelper (const Vector< T, d > &v1, const Vector< T, d > &v2, const T percent)
 Linearly interpolate two vectors. More...
 
template<class T , int d>
Vector< T, d > mathfu::RandomInRangeHelper (const Vector< T, d > &min, const Vector< T, d > &max)
 Generates a random vector. More...
 
template<class T , int d>
Vector< T, d > mathfu::MaxHelper (const Vector< T, d > &v1, const Vector< T, d > &v2)
 Compare each component and returns max values. More...
 
template<class T , int d>
Vector< T, d > mathfu::MinHelper (const Vector< T, d > &v1, const Vector< T, d > &v2)
 Compare each component and returns min values. More...
 
template<class T >
bool mathfu::InRange2D (const mathfu::Vector< T, 2 > &val, const mathfu::Vector< T, 2 > &range_start, const mathfu::Vector< T, 2 > &range_end)
 Check if val is within [range_start..range_end), denoting a rectangular area. More...
 
template<typename T , int d>
Vector< T, d > mathfu::RoundUpToPowerOf2 (const Vector< T, d > &v)
 Specialized version of RoundUpToPowerOf2 for vector.