|
SpatiumLib
|
#include <Vector3.h>


Public Member Functions | |
| Vector3 () | |
| Constructor. More... | |
| Vector3 (double x, double y, double z) | |
| Constructor. More... | |
| Vector3 (double xyz[]) | |
| Constructor. More... | |
| Vector3 (const Vector3 &other) | |
| Copy constructor. More... | |
| Vector3 (const Matrix &other) | |
| Copy constructor. More... | |
| Vector3 & | operator= (Vector3 other) |
| Assignment operator. More... | |
| ~Vector3 ()=default | |
| Desctructor. More... | |
| void | x (double val) |
| double | x () const |
| void | y (double val) |
| double | y () const |
| void | z (double val) |
| double | z () const |
| double * | array () |
| Get coordinates as array. More... | |
| Vector3 | operator+ (const Matrix &other) const |
| Add matrix to vector. More... | |
| Vector3 | operator- (const Matrix &other) const |
| Subtract matrix from vector. More... | |
| Vector3 | operator * (double scalar) const |
| Multiply vector by scalar. More... | |
| Vector3 | operator/ (double scalar) const |
| Divide by scalar. More... | |
| double | length () const |
| Calculate length of vector (magnitude). More... | |
| void | normalize () |
| Normalize the vector. A normalized vector has length = 1. More... | |
| Vector3 | normalized () const |
| Get normalized copy of vector. A normalized vector has length = 1. More... | |
| double | dot (const Vector3 &other) const |
| Calculate dot product with vector. Dot product = 0: vectors are orthogonal (perpendicular). Dot product = |a||b| (1 if normalized): vectors are parallel. More... | |
| double | angle (const Vector3 &other) const |
| Calculate angle with vector. More... | |
| Vector3 | cross (const Vector3 &other) const |
| Calculate cross product with vector. The cross product is perpendicular to the two input vectors. The result can be NaN. More... | |
| Vector3 | project (const Vector3 &other) const |
| Project vector onto vector. More... | |
Public Member Functions inherited from spatium::Vector | |
| Vector (size_t rows) | |
| Constructor. More... | |
| Vector (std::initializer_list< double > array) | |
| Constructor. More... | |
| Vector (const std::vector< double > &vector) | |
| Constructor. More... | |
| Vector (const Vector &other) | |
| Copy constructor. More... | |
| Vector (const Matrix &other) | |
| Copy constructor. More... | |
| Vector & | operator= (const Vector &other)=default |
| Assignment operator. More... | |
| ~Vector ()=default | |
| Destructor. More... | |
| double | operator() (size_t row) const |
| Access element by value. More... | |
| double & | operator() (size_t row) |
| Access element by reference. More... | |
| Vector | operator+ (const Matrix &other) const |
| Add matrix to vector. More... | |
| Vector | operator- (const Matrix &other) const |
| Subtract matrix from vector. More... | |
| Vector | operator * (double scalar) const |
| Multiply by scalar. More... | |
| Vector | operator/ (double scalar) const |
| Divide by scalar. More... | |
| void | resize (size_t rows) |
| Resize. More... | |
Public Member Functions inherited from spatium::Matrix | |
| Matrix (size_t rows, size_t cols) | |
| Constructor. More... | |
| Matrix (std::initializer_list< std::initializer_list< double >> array) | |
| Constructor. More... | |
| bool | operator== (const Matrix &other) const |
| Compare operator. Is equal. More... | |
| bool | operator!= (const Matrix &other) const |
| Compare operator. Is unequal. More... | |
| size_t | rows () const |
| Get the number of rows. More... | |
| size_t | cols () const |
| Get the number of columns. More... | |
| std::vector< double > | data () const |
| Get all matrix elements. More... | |
| void | clear () |
| Clear all matrix elements. More... | |
| Matrix | transposed () const |
| Get transposed matrix. More... | |
| double | determinant () const |
| Calculate determinant. More... | |
| double | minor (size_t row, size_t col) const |
| Calulcate minor. More... | |
| Matrix | omit (size_t row, size_t col) const |
| Omit a given row and column. More... | |
| Matrix | inverse () const |
| Calculate inverse of matrix. More... | |
| double | operator() (size_t row, size_t col) const |
| Access element by value. More... | |
| double & | operator() (size_t row, size_t col) |
| Access element by reference. More... | |
| Matrix | operator+ (const Matrix &other) const |
| Add by matrix. More... | |
| Matrix | operator- (const Matrix &other) const |
| Subtract by matrix. More... | |
| Matrix | operator * (const Matrix &other) const |
| Multiply by matrix. More... | |
| Matrix | operator * (double scalar) const |
| Multiply by scalar. More... | |
| Matrix | operator/ (double scalar) const |
| Divide by scalar. More... | |
| void | resize (size_t rows, size_t cols) |
| Resize. More... | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Vector3 &vector) |
| Output to ostream. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from spatium::Matrix | |
| static Matrix | identity (size_t order) |
| Construct identity matrix. More... | |
Protected Member Functions inherited from spatium::Matrix | |
| double | determinant (const Matrix &matrix) const |
| Calculate determinant. More... | |
Protected Attributes inherited from spatium::Matrix | |
| size_t | m_rows |
| size_t | m_cols |
| std::vector< double > | m_data |
Vector in 3D space.
Column vector with 4 rows. The first three elements define the X, Y and Z coordinates. The fourth element is always 0.
|
inline |
Constructor.
|
inline |
Constructor.
| [in] | x | X coordinate |
| [in] | y | Y coordinate |
| [in] | z | Z coordinate |
|
inline |
Constructor.
| [in] | xyz | Array with X, Y and Z coordinates |
|
inline |
Copy constructor.
|
inline |
Copy constructor.
| [in] | other | Other matrix |
| std::out_of_range | Matrix dimensions out of range |
|
default |
Desctructor.
|
inline |
Calculate angle with vector.
| [in] | other | Other vector |
|
inline |
Get coordinates as array.
Calculate cross product with vector. The cross product is perpendicular to the two input vectors. The result can be NaN.
| [in] | other | Other vector |
|
inline |
Calculate dot product with vector. Dot product = 0: vectors are orthogonal (perpendicular). Dot product = |a||b| (1 if normalized): vectors are parallel.
| [in] | other | Other vector |
|
inline |
Calculate length of vector (magnitude).
|
inline |
Normalize the vector. A normalized vector has length = 1.
|
inline |
Get normalized copy of vector. A normalized vector has length = 1.
|
inline |
Multiply vector by scalar.
| [in] | scalar |
|
inline |
Divide by scalar.
| [in] | scalar | Scalar |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
Output to ostream.
1.8.15