Implementation of three- and four-dimensional vectors and matrices for geometric operations.
More...
#include <cstring>
#include <cmath>
Go to the source code of this file.
|
template<typename T > |
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...
|
|
Implementation of three- and four-dimensional vectors and matrices for geometric operations.
- Author
- Finn Lasse Buessen
- Copyright
- Copyright (c) 2020
◆ 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
-
T | Underlying fundamental type of vectors. |
- Parameters
-
v | Left operand. |
w | Right 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
-
T | Underlying fundamental type of vectors. |
- Parameters
-
v | Left operand. |
w | Right 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
-
T | Underlying fundamental data type. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental data type. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental data type. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental data type. |
- Parameters
-
lhs | Scalar operand. |
rhs | Matrix 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
-
T | Underlying fundamental type of the vector. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental type of the vector. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental type of the vector. |
- Parameters
-
lhs | Left operand. |
rhs | Right 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
-
T | Underlying fundamental type of the vector. |
- Parameters
-
- 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
-
T | Underlying fundamental type of the vector. |
- Parameters
-
lhs | Left operand. |
rhs | Right operand. |
- Returns
- bool Returns true if lhs equls rhs. Returns false otherwise.