SpinParser  1.0
Classes | Functions
Geometry.hpp File Reference

Implementation of three- and four-dimensional vectors and matrices for geometric operations. More...

#include <cstring>
#include <cmath>
Include dependency graph for Geometry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  geometry::Vec3< T >
 Three-dimensional vector. More...
 
struct  geometry::Vec4< T >
 Four-dimensional vector. More...
 
struct  geometry::Mat3< T >
 3x3 dimensional matrix. More...
 
struct  geometry::Mat4< T >
 4x4 dimensional matrix. More...
 

Functions

template<typename T >
geometry::dot (const Vec3< T > &v, const Vec3< T > &w)
 Compute the dot product of two Vec3 objects. More...
 
template<typename T >
Vec3< T > geometry::cross (const Vec3< T > &v, const Vec3< T > &w)
 Compute the cross producdt of two Vec3 objects. More...
 
template<typename T >
Vec3< T > geometry::operator* (const T lhs, const Vec3< T > &rhs)
 Scalar left-multiplication of a Vec3 object. More...
 
template<typename T >
Vec3< T > geometry::operator+ (const Vec3< T > &lhs, const Vec3< T > &rhs)
 Addition of two Vec3 objects. More...
 
template<typename T >
Vec3< T > geometry::operator- (const Vec3< T > &lhs, const Vec3< T > &rhs)
 Subtraction of two Vec3 objects. More...
 
template<typename T >
Vec3< T > geometry::operator- (const Vec3< T > &rhs)
 Inversion of a Vec3 object with respect to addition. More...
 
template<typename T >
bool geometry::operator== (const Vec3< T > &lhs, const Vec3< T > &rhs)
 Comparison of two Vec3 objects. More...
 
template<typename T >
Mat3< T > geometry::operator* (const T &lhs, const Mat3< T > &rhs)
 Scalar left-multiplication of a Mat3 object. More...
 
template<typename T >
Mat4< T > geometry::operator* (const Mat4< T > &lhs, const Mat4< T > &rhs)
 Multiplication of two Mat4 objects. More...
 
template<typename T >
Vec3< T > geometry::operator* (const Mat3< T > &lhs, const Vec3< T > &rhs)
 Matrix vector multiplication of 3x3 matrix and a three-dimensional vector. More...
 
template<typename T >
Vec3< T > geometry::operator* (const Mat4< T > &lhs, const Vec3< T > &rhs)
 Matrix vector multiplication of 4x4 matrix and a three-dimensional vector by padding the vector with 1 in the fourth dimension and returning only the first three entries. More...
 

Detailed Description

Implementation of three- and four-dimensional vectors and matrices for geometric operations.

Author
Finn Lasse Buessen

Function Documentation

◆ cross()

template<typename T >
Vec3<T> geometry::cross ( const Vec3< T > &  v,
const Vec3< T > &  w 
)

Compute the cross producdt of two Vec3 objects.

Template Parameters
TUnderlying fundamental type of vectors.
Parameters
vLeft operand.
wRight operand.
Returns
Vec3<T> Cross product of v and w.

◆ dot()

template<typename T >
T geometry::dot ( const Vec3< T > &  v,
const Vec3< T > &  w 
)

Compute the dot product of two Vec3 objects.

Template Parameters
TUnderlying fundamental type of vectors.
Parameters
vLeft operand.
wRight operand.
Returns
T Dot product of v and w.

◆ operator*() [1/5]

template<typename T >
Vec3<T> geometry::operator* ( const Mat3< T > &  lhs,
const Vec3< T > &  rhs 
)

Matrix vector multiplication of 3x3 matrix and a three-dimensional vector.

Template Parameters
TUnderlying fundamental data type.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Vec3<T> Value of lhs * rhs.

◆ operator*() [2/5]

template<typename T >
Mat4<T> geometry::operator* ( const Mat4< T > &  lhs,
const Mat4< T > &  rhs 
)

Multiplication of two Mat4 objects.

Template Parameters
TUnderlying fundamental data type.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Mat4<T> Value of the product lhs * rhs.

◆ operator*() [3/5]

template<typename T >
Vec3<T> geometry::operator* ( const Mat4< T > &  lhs,
const Vec3< T > &  rhs 
)

Matrix vector multiplication of 4x4 matrix and a three-dimensional vector by padding the vector with 1 in the fourth dimension and returning only the first three entries.

Template Parameters
TUnderlying fundamental data type.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Vec3<T> Result of lhs * rhs.

◆ operator*() [4/5]

template<typename T >
Mat3<T> geometry::operator* ( const T &  lhs,
const Mat3< T > &  rhs 
)

Scalar left-multiplication of a Mat3 object.

Template Parameters
TUnderlying fundamental data type.
Parameters
lhsScalar operand.
rhsMatrix operand.
Returns
Mat3<T> Value of lhs * rhs.

◆ operator*() [5/5]

template<typename T >
Vec3<T> geometry::operator* ( const T  lhs,
const Vec3< T > &  rhs 
)

Scalar left-multiplication of a Vec3 object.

Template Parameters
TUnderlying fundamental type of the vector.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Vec3<T> Product lhs * rhs.

◆ operator+()

template<typename T >
Vec3<T> geometry::operator+ ( const Vec3< T > &  lhs,
const Vec3< T > &  rhs 
)

Addition of two Vec3 objects.

Template Parameters
TUnderlying fundamental type of the vector.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Vec3<T> Sum lhs + rhs.

◆ operator-() [1/2]

template<typename T >
Vec3<T> geometry::operator- ( const Vec3< T > &  lhs,
const Vec3< T > &  rhs 
)

Subtraction of two Vec3 objects.

Template Parameters
TUnderlying fundamental type of the vector.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
Vec3<T> Difference lhs - rhs.

◆ operator-() [2/2]

template<typename T >
Vec3<T> geometry::operator- ( const Vec3< T > &  rhs)

Inversion of a Vec3 object with respect to addition.

Template Parameters
TUnderlying fundamental type of the vector.
Parameters
rhsVector object.
Returns
Vec3<T> Inverted vector -rhs.

◆ operator==()

template<typename T >
bool geometry::operator== ( const Vec3< T > &  lhs,
const Vec3< T > &  rhs 
)

Comparison of two Vec3 objects.

Template Parameters
TUnderlying fundamental type of the vector.
Parameters
lhsLeft operand.
rhsRight operand.
Returns
bool Returns true if lhs equls rhs. Returns false otherwise.