33 #ifndef __H__COMMON__MATH_VECTOR_FUNCTIONS__
34 #define __H__COMMON__MATH_VECTOR_FUNCTIONS__
49 template <
typename vector_target_t,
typename vector_source_t>
58 template <
typename vector_t>
61 VecAppend(vector_t& vOut,
const vector_t& v1);
65 template <
typename vector_t>
68 VecAppend(vector_t& vOut,
const vector_t& v1,
const vector_t& v2);
72 template <
typename vector_t>
75 VecAppend(vector_t& vOut,
const vector_t& v1,
const vector_t& v2,
80 template <
typename vector_t>
83 VecAppend(vector_t& vOut,
const vector_t& v1,
const vector_t& v2,
84 const vector_t& v3,
const vector_t& v4);
91 template <
typename vector_t>
98 template <
typename vector_t>
106 template <
typename vector_t>
115 template <
typename vector_t>
129 template <
typename vector_t>
132 VecAdd(vector_t& vOut,
const vector_t& v1,
const vector_t& v2);
136 template <
typename vector_t>
139 VecAdd(vector_t& vOut,
const vector_t& v1,
const vector_t& v2,
144 template <
typename vector_t>
147 VecAdd(vector_t& vOut,
const vector_t& v1,
const vector_t& v2,
148 const vector_t& v3,
const vector_t& v4);
155 template <
typename vector_t>
158 VecSubtract(vector_t& vOut,
const vector_t& v1,
const vector_t& v2);
162 template <
typename vector_t>
173 template <
typename vector_t>
183 template <
typename vector_t>
191 template <
typename vector_t>
200 template <
typename vector_t>
212 template <
typename vector_t>
222 template <
typename vector_t>
228 template <
typename vector_t>
237 template <
typename vector_t>
243 template <
typename vector_t>
246 VecDistance(
const vector_t& v1,
const vector_t& v2);
252 template <
typename vector_t>
255 VecDot(
const vector_t& v1,
const vector_t& v2);
260 template <
typename vector_t>
263 VecAngle(
const vector_t& v1,
const vector_t& v2);
270 template <
typename vector_t>
278 template <
typename vector_t>
281 VecCross(vector_t& vOut,
const vector_t& v1,
const vector_t& v2);
286 template <
size_t dim>
289 MathVector<dim> & result,
290 const MathVector<dim> & v_1,
const MathVector<dim> & v_2
296 template <
typename vector_t>
306 template <
typename vector_t>
310 const vector_t& v2,
const vector_t& v3);
317 template <
typename vector_t>
321 const vector_t& v2,
const vector_t& v3);
328 template <
typename vector_t>
334 template <
typename vector_t>
340 template <
typename vector_t>
347 template <
typename vector_t>
352 template <
typename vector_t>
357 template <
typename vector_t>
362 template <
typename vector_t>
365 VecPNorm(
const vector_t& v,
unsigned int p);
367 template <
typename vector_t>
372 template <
typename vector_t>
385 template <
typename vector_t>
388 VecElemProd(vector_t& vOut,
const vector_t& v1,
const vector_t& v2);
391 template <
typename vector_t>
397 template <
typename vector_t>
403 template <
typename vector_t>
409 template <
typename vector_t>
412 VecIsInBB(
const vector_t& v,
const vector_t& low,
const vector_t& high);
vector_t::value_type VecLength(const vector_t &v)
returns the length of v. Slower than VecLengthSq.
Definition: math_vector_functions_common_impl.hpp:341
void VecScaleAppend(vector_t &vOut, typename vector_t::value_type s1, const vector_t &v1)
Scales a Vector and adds it to a second vector.
Definition: math_vector_functions_common_impl.hpp:126
void 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.
Definition: math_vector_functions_common_impl.hpp:56
vector_t::value_type VecMaxNorm(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:625
void 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
Definition: math_vector_functions_common_impl.hpp:465
void VecSet(vector_t &vInOut, typename vector_t::value_type s)
Set each vector component to scalar (componentwise)
Definition: math_vector_functions_common_impl.hpp:539
void 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.
Definition: math_vector_functions_common_impl.hpp:265
vector_t::value_type VecTwoNormSq(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:585
vector_t::value_type VecOneNorm(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:593
void VecNormalize(vector_t &vOut, const vector_t &v)
scales a vector_t to unit length
Definition: math_vector_functions_common_impl.hpp:501
void 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).
Definition: math_vector_functions_common_impl.hpp:514
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition: math_vector_functions_common_impl.hpp:226
vector_t::value_type VecAngle(const vector_t &v1, const vector_t &v2)
returns the angle between two vectors in radiants
Definition: math_vector_functions_common_impl.hpp:401
vector_t::value_type VecDistanceSq(const vector_t &v1, const vector_t &v2)
returns the squared distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:351
void 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).
Definition: math_vector_functions_common_impl.hpp:528
void VecAppend(vector_t &vOut, const vector_t &v1)
adds a MathVector<N> to a second one
Definition: math_vector_functions_common_impl.hpp:72
vector_t::value_type VecLengthSq(const vector_t &v)
returns the squared length of v. Faster than VecLength.
Definition: math_vector_functions_common_impl.hpp:324
vector_t::value_type VecDistance(const vector_t &v1, const vector_t &v2)
returns the distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:375
void 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
Definition: math_vector_functions_common_impl.hpp:185
void VecScale(vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
scales a MathVector<N>
Definition: math_vector_functions_common_impl.hpp:252
vector_t::value_type VecTwoNorm(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:577
void 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 vec...
Definition: math_vector_functions_common_impl.hpp:437
void VecPow(vector_t &vOut, const vector_t &v1, typename vector_t::value_type s)
component-wise exponentiation of a vector
Definition: math_vector_functions_common_impl.hpp:239
vector_t::value_type VecAngleNorm(const vector_t &v1, const vector_t &v2)
returns the angle between two vectors of length 1 in radiants
Definition: math_vector_functions_common_impl.hpp:421
void VecInterpolateLinear(vector_t &vOut, const vector_t &v1, const vector_t &v2, typename vector_t::value_type interpAmount)
Definition: math_vector_functions_common_impl.hpp:310
vector_t::value_type VecDot(const vector_t &v1, const vector_t &v2)
returns the dot-product of two vector_ts
Definition: math_vector_functions_common_impl.hpp:385
vector_t::value_type VecInftyNorm(const vector_t &v)
Definition: math_vector_functions_common_impl.hpp:641
vector_t::value_type VecPNorm(const vector_t &v, unsigned int p)
Definition: math_vector_functions_common_impl.hpp:609
size_t target(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &m)
Definition: bidirectional_boost.h:100
size_t source(SM_edge< typename T::value_type > const &e, ug::BidirectionalMatrix< T > const &)
Definition: bidirectional_boost.h:94
bool 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
Definition: math_vector_functions_common_impl.hpp:701
void VecElemProd(vector_t &vOut, const vector_t &v1, const vector_t &v2)
component-wise product: vOut_i = v1_i*v2_i
Definition: math_vector_functions_common_impl.hpp:651
bool VecAbsIsLess(const vector_t &v1, const vector_t &v2)
component-wise comparison of two vectors (in the absolute values)
Definition: math_vector_functions_common_impl.hpp:677
void VecElemSqrt(vector_t &vOut, const vector_t &v1)
component-wise square root:
Definition: math_vector_functions_common_impl.hpp:664
T value_type
Definition: sparsematrix_interface.h:2