Manifold 3.0
Robust geometry
 
Loading...
Searching...
No Matches
Vec_algebra

Support for vector algebra. More...

Functions

template<class T >
constexpr T cross (const vec< T, 2 > &a, const vec< T, 2 > &b)
 shorthand for cross({a.x,a.y,0}, {b.x,b.y,0}).z
 
template<class T >
constexpr vec< T, 2 > cross (T a, const vec< T, 2 > &b)
 shorthand for cross({0,0,a.z}, {b.x,b.y,0}).xy()
 
template<class T >
constexpr vec< T, 2 > cross (const vec< T, 2 > &a, T b)
 shorthand for cross({a.x,a.y,0}, {0,0,b.z}).xy()
 
template<class T >
constexpr vec< T, 3 > cross (const vec< T, 3 > &a, const vec< T, 3 > &b)
 the cross or vector product of vectors a and b
 
template<class T , int M>
constexpr T dot (const vec< T, M > &a, const vec< T, M > &b)
 dot or inner product of vectors a and b
 
template<class T , int M>
constexpr T length2 (const vec< T, M > &a)
 square of the length or magnitude of vector a
 
template<class T , int M>
length (const vec< T, M > &a)
 length or magnitude of a vector a
 
template<class T , int M>
vec< T, M > normalize (const vec< T, M > &a)
 unit length vector in the same direction as a (undefined for zero-length vectors)
 
template<class T , int M>
constexpr T distance2 (const vec< T, M > &a, const vec< T, M > &b)
 square of the Euclidean distance between points a and b
 
template<class T , int M>
distance (const vec< T, M > &a, const vec< T, M > &b)
 Euclidean distance between points a and b
 
template<class T , int M>
uangle (const vec< T, M > &a, const vec< T, M > &b)
 Return the angle in radians between two unit vectors.
 
template<class T , int M>
angle (const vec< T, M > &a, const vec< T, M > &b)
 Return the angle in radians between two non-unit vectors.
 
template<class T >
vec< T, 2 > rot (T a, const vec< T, 2 > &v)
 vector v rotated counter-clockwise by the angle a in radians
 
template<class T >
vec< T, 3 > rotx (T a, const vec< T, 3 > &v)
 vector v rotated counter-clockwise by the angle a in radians around the X axis
 
template<class T >
vec< T, 3 > roty (T a, const vec< T, 3 > &v)
 vector v rotated counter-clockwise by the angle a in radians around the Y axis
 
template<class T >
vec< T, 3 > rotz (T a, const vec< T, 3 > &v)
 vector v rotated counter-clockwise by the angle a in radians around the Z axis
 
template<class T , int M>
vec< T, M > nlerp (const vec< T, M > &a, const vec< T, M > &b, T t)
 shorthand for normalize(lerp(a,b,t))
 
template<class T , int M>
vec< T, M > slerp (const vec< T, M > &a, const vec< T, M > &b, T t)
 spherical linear interpolation between unit vectors a and b (undefined for non-unit vectors) by parameter t
 

Detailed Description

Support for vector algebra.