ug4
math_vector_functions_common_impl.hpp File Reference
#include <cmath>
#include <algorithm>
#include "common/error.h"
#include "common/assert.h"
#include "common/static_assert.h"

Go to the source code of this file.

Namespaces

 ug
 the ug namespace
 

Functions

template<typename vector_t >
void ug::CalculateTriangleNormal (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 Calculates a triangle-normal in 3d (output has length 1). More...
 
template<typename vector_t >
void ug::CalculateTriangleNormalNoNormalize (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 Calculates a triangle-normal in 3d (no normalization is performed). More...
 
template<size_t dim>
void ug::GenVecCross (MathVector< dim > &result, const MathVector< dim > &v_1, const MathVector< dim > &v_2)
 calculates the usual cross product in 3d, and the (det, 0) vector as a cross product in 2d More...
 
template<>
void ug::GenVecCross< 2 > (MathVector< 2 > &result, const MathVector< 2 > &v_1, const MathVector< 2 > &v_2)
 specialization of the "generalized vector product" in 2d. More...
 
template<>
void ug::GenVecCross< 3 > (MathVector< 3 > &result, const MathVector< 3 > &v_1, const MathVector< 3 > &v_2)
 specialization of the "generalized vector product" in 3d. More...
 
template<typename vector_t >
bool ug::VecAbsIsLess (const vector_t &v1, const typename vector_t::value_type s)
 component-wise comparison of a vector (in the absolute values) with a given number More...
 
template<typename vector_t >
bool ug::VecAbsIsLess (const vector_t &v1, const vector_t &v2)
 component-wise comparison of two vectors (in the absolute values) More...
 
template<typename vector_t >
void ug::VecAdd (vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
 Add a scalar to a vector (componentwise) More...
 
template<typename vector_t >
void ug::VecAdd (vector_t &vOut, const vector_t &v1, const vector_t &v2)
 adds two MathVector<N>s and stores the result in a third one More...
 
template<typename vector_t >
void ug::VecAdd (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 adds three MathVector<N>s and stores the result in a fourth one More...
 
template<typename vector_t >
void ug::VecAdd (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3, const vector_t &v4)
 adds four MathVector<N>s and stores the result in a firth one More...
 
template<typename vector_t >
vector_t::value_type ug::VecAngle (const vector_t &v1, const vector_t &v2)
 returns the angle between two vectors in radiants More...
 
template<typename vector_t >
vector_t::value_type ug::VecAngleNorm (const vector_t &v1, const vector_t &v2)
 returns the angle between two vectors of length 1 in radiants More...
 
template<typename vector_t >
void ug::VecAppend (vector_t &vOut, const vector_t &v1)
 adds a MathVector<N> to a second one More...
 
template<typename vector_t >
void ug::VecAppend (vector_t &vOut, const vector_t &v1, const vector_t &v2)
 adds two MathVector<N>s and adds the result to a third one More...
 
template<typename vector_t >
void ug::VecAppend (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3)
 adds two MathVector<N>s and adds the result to a fourth one More...
 
template<typename vector_t >
void ug::VecAppend (vector_t &vOut, const vector_t &v1, const vector_t &v2, const vector_t &v3, const vector_t &v4)
 adds two MathVector<N>s and adds the result to a fifth one More...
 
template<typename vector_target_t , typename vector_source_t >
void ug::VecCopy (vector_target_t &target, const vector_source_t &source, typename vector_target_t::value_type fill)
 Copy contents between vectors of possibly different types. More...
 
template<typename vector_t >
void ug::VecCross (vector_t &vOut, const vector_t &v1, const vector_t &v2)
 calculates the cross product of two Vectors of dimension 3. It makes no sense to use VecCross for vector_ts that have not dimension 3. More...
 
template<typename vector_t >
vector_t::value_type ug::VecDistance (const vector_t &v1, const vector_t &v2)
 returns the distance of two vector_ts. More...
 
template<typename TVector , typename TMatrix >
TVector::value_type ug::VecDistanceSq (const TVector &v1, const TVector &v2, const TMatrix &M)
 returns the squared distance of two MathVector<N>s. More...
 
template<typename vector_t >
vector_t::value_type ug::VecDistanceSq (const vector_t &v1, const vector_t &v2)
 returns the squared distance of two vector_ts. More...
 
template<typename vector_t >
vector_t::value_type ug::VecDot (const vector_t &v1, const vector_t &v2)
 returns the dot-product of two vector_ts More...
 
template<typename vector_t >
void ug::VecElemProd (vector_t &vOut, const vector_t &v1, const vector_t &v2)
 component-wise product: vOut_i = v1_i*v2_i More...
 
template<typename vector_t >
void ug::VecElemSqrt (vector_t &vOut, const vector_t &v1)
 component-wise square root: \(o_i=\sqrt {v_i}\) More...
 
template<typename vector_t >
vector_t::value_type ug::VecInftyNorm (const vector_t &v)
 
template<typename vector_t >
void ug::VecInterpolateLinear (vector_t &vOut, const vector_t &v1, const vector_t &v2, typename vector_t::value_type interpAmount)
 
template<typename vector_t >
bool ug::VecIsInBB (const vector_t &v, const vector_t &low, const vector_t &high)
 checks if the given point is in the bounding box given by two other points More...
 
template<typename vector_t >
vector_t::value_type ug::VecLength (const vector_t &v)
 returns the length of v. Slower than VecLengthSq. More...
 
template<typename vector_t >
vector_t::value_type ug::VecLengthSq (const vector_t &v)
 returns the squared length of v. Faster than VecLength. More...
 
template<typename vector_t >
vector_t::value_type ug::VecMaxNorm (const vector_t &v)
 
template<typename vector_t >
void ug::VecNormalize (vector_t &vOut, const vector_t &v)
 scales a vector_t to unit length More...
 
template<typename vector_t >
vector_t::value_type ug::VecOneNorm (const vector_t &v)
 
template<typename vector_t >
vector_t::value_type ug::VecPNorm (const vector_t &v, unsigned int p)
 
template<typename vector_t >
void ug::VecPow (vector_t &vOut, const vector_t &v1, typename vector_t::value_type s)
 component-wise exponentiation of a vector More...
 
template<typename vector_t >
void ug::VecScale (vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
 scales a MathVector<N> More...
 
template<typename vector_t >
void ug::VecScaleAdd (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
 Scales two Vectors, adds them and returns the sum in a third vector. More...
 
template<typename vector_t >
void ug::VecScaleAdd (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2, typename vector_t::value_type s3, const vector_t &v3)
 Scales three Vectors, adds them and returns the sum in a fourth vector. More...
 
template<typename vector_t >
void ug::VecScaleAdd (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2, typename vector_t::value_type s3, const vector_t &v3, typename vector_t::value_type s4, const vector_t &v4)
 Scales four Vectors, adds them and returns the sum in a fifth vector. More...
 
template<typename vector_t >
void ug::VecScaleAppend (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1)
 Scales a Vector and adds it to a second vector. More...
 
template<typename vector_t >
void ug::VecScaleAppend (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2)
 Scales two Vectors, adds them and adds the sum to a third vector. More...
 
template<typename vector_t >
void ug::VecScaleAppend (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2, typename vector_t::value_type s3, const vector_t &v3)
 Scales three Vectors, adds them and adds the sum to a fourth vector. More...
 
template<typename vector_t >
void ug::VecScaleAppend (vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1, typename vector_t::value_type s2, const vector_t &v2, typename vector_t::value_type s3, const vector_t &v3, typename vector_t::value_type s4, const vector_t &v4)
 Scales four Vectors, adds them and adds the sum to a fifth vector. More...
 
template<typename vector_t >
void ug::VecSet (vector_t &vInOut, typename vector_t::value_type s)
 Set each vector component to scalar (componentwise) More...
 
template<typename vector_t >
void ug::VecSubtract (vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
 Subtract a scalar from a vector (componentwise) More...
 
template<typename vector_t >
void ug::VecSubtract (vector_t &vOut, const vector_t &v1, const vector_t &v2)
 subtracts v2 from v1 and stores the result in a vOut More...
 
template<typename vector_t >
vector_t::value_type ug::VecTwoNorm (const vector_t &v)
 
template<typename vector_t >
vector_t::value_type ug::VecTwoNormSq (const vector_t &v)