|
LuciadCPillar 2026.1
|
A general-purpose 4x4 matrix, defined in a right-handed coordinate system. More...
#include <luciad/cartesian/Matrix4x4.h>
Public Member Functions | |
| Matrix4x4 () | |
| Default constructor. | |
| Matrix4x4 | add (const Matrix4x4 &other) const |
| Returns the sum of two matrices. | |
| size_t | getHash () const |
| Returns the hash of this matrix. | |
| double | getValue (size_t column, size_t row) const |
| Returns the value from the given column and row. | |
| std::optional< Matrix4x4 > | inverse () const |
| Returns the inverse of this matrix, or std::nullopt if this matrix is not invertible. | |
| bool | isAffineTransformation () const |
| Returns whether this arbitrary matrix represents a valid 3D affine transformation. | |
| Coordinate | multiply (const Coordinate &point) const |
| Applies this matrix as an affine transformation to a point. | |
| Matrix4x4 | multiply (const Matrix4x4 &other) const |
| Returns the product of two matrices. | |
| Matrix4x4 | multiply (double scalar) const |
| Returns the element-wise product between this matrix and a scalar. | |
| bool | operator!= (const Matrix4x4 &other) const |
| Coordinate | operator* (const Coordinate &point) const |
| Matrix4x4 | operator* (const Matrix4x4 &other) const |
| Matrix4x4 | operator* (double scalar) const |
| Matrix4x4 & | operator*= (const Matrix4x4 &other) |
| Matrix4x4 & | operator*= (double scalar) |
| Matrix4x4 | operator+ (const Matrix4x4 &other) const |
| Matrix4x4 & | operator+= (const Matrix4x4 &other) |
| Matrix4x4 | operator- (const Matrix4x4 &other) const |
| Matrix4x4 & | operator-= (const Matrix4x4 &other) |
| bool | operator== (const Matrix4x4 &other) const |
| void | setValue (size_t column, size_t row, double value) |
| Sets the value at the given column and row. | |
| Matrix4x4 | subtract (const Matrix4x4 &other) const |
| Returns the difference of two matrices. | |
| Coordinate | transformPoint (const Coordinate &point) const |
| Applies this matrix as an affine transformation to a point. | |
| Coordinate | transformVector (const Coordinate &vector) const |
| Applies this matrix as an affine transformation to a vector. | |
| Matrix4x4 | transpose () const |
| Returns the transpose of this matrix. | |
Static Public Member Functions | |
| static Matrix4x4 | create (const std::vector< double > &values) |
| Creates a new 4x4 matrix with the given values. | |
| static Matrix4x4 | identity () |
| Creates a new identity matrix. | |
| static Matrix4x4 | rotate (const Coordinate &axis, Angle angle) |
| Creates a new rotation matrix around a given vector. | |
| static Matrix4x4 | rotateX (Angle angle) |
| Creates a new rotation matrix around the x-axis. | |
| static Matrix4x4 | rotateY (Angle angle) |
| Creates a new rotation matrix around the y-axis. | |
| static Matrix4x4 | rotateZ (Angle angle) |
| Creates a new rotation matrix around the z-axis. | |
| static Matrix4x4 | scale (double scalar) |
| Creates a new scaling matrix in all 3 dimensions. | |
| static Matrix4x4 | scale (double x, double y, double z) |
| Creates a new scaling matrix. | |
| static Matrix4x4 | translate (const Coordinate &translation) |
| Creates a new translation matrix. | |
| static Matrix4x4 | translate (double x, double y, double z) |
| Creates a new translation matrix. | |
A general-purpose 4x4 matrix, defined in a right-handed coordinate system.
A common use case for this class is to represent affine 3D transformations, such as translations, scalings, and rotations.
| luciad::Matrix4x4::Matrix4x4 | ( | ) |
Default constructor.
Constructs the identity matrix.
Returns the sum of two matrices.
| other | the other matrix. |
|
static |
Creates a new 4x4 matrix with the given values.
The values are expected in column-major order. For example, a list like [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] will become the following matrix:
[ 0 4 8 12 ] [ 1 5 9 13 ] [ 2 6 10 14 ] [ 3 7 11 15 ]
| values | a list of 16 values, in column-major order. |
| luciad::InvalidArgumentException | when the list does not contain exactly 16 values. |
| size_t luciad::Matrix4x4::getHash | ( | ) | const |
Returns the hash of this matrix.
| double luciad::Matrix4x4::getValue | ( | size_t | column, |
| size_t | row ) const |
Returns the value from the given column and row.
| column | the column. |
| row | the row. |
|
static |
Creates a new identity matrix.
[ 1 0 0 0 ] [ 0 1 0 0 ] [ 0 0 1 0 ] [ 0 0 0 1 ]
| std::optional< Matrix4x4 > luciad::Matrix4x4::inverse | ( | ) | const |
Returns the inverse of this matrix, or std::nullopt if this matrix is not invertible.
| bool luciad::Matrix4x4::isAffineTransformation | ( | ) | const |
Returns whether this arbitrary matrix represents a valid 3D affine transformation.
This is equivalent to checking whether the matrix has the following form:
[ . . . . ] [ . . . . ] [ . . . . ] [ 0 0 0 1 ]
| Coordinate luciad::Matrix4x4::multiply | ( | const Coordinate & | point | ) | const |
Applies this matrix as an affine transformation to a point.
This method does the same as transformPoint.
| point | the point. |
Returns the product of two matrices.
| other | the other matrix. |
| Matrix4x4 luciad::Matrix4x4::multiply | ( | double | scalar | ) | const |
Returns the element-wise product between this matrix and a scalar.
| scalar | the scalar. |
| bool luciad::Matrix4x4::operator!= | ( | const Matrix4x4 & | other | ) | const |
| Coordinate luciad::Matrix4x4::operator* | ( | const Coordinate & | point | ) | const |
| Matrix4x4 luciad::Matrix4x4::operator* | ( | double | scalar | ) | const |
| Matrix4x4 & luciad::Matrix4x4::operator*= | ( | double | scalar | ) |
| bool luciad::Matrix4x4::operator== | ( | const Matrix4x4 & | other | ) | const |
|
static |
Creates a new rotation matrix around a given vector.
Note: the rotation happens counterclockwise. When imagining the vector as an arrow, looking at the arrowhead coming towards you makes the rotation appear counterclockwise.
| axis | the vector to rotate around. |
| angle | the amount to rotate. |
Creates a new rotation matrix around the x-axis.
Note: the rotation happens counterclockwise. Looking towards negative infinity on the x-axis makes the rotation appear counterclockwise.
| angle | the amount to rotate. |
Creates a new rotation matrix around the y-axis.
Note: the rotation happens counterclockwise. Looking towards negative infinity on the y-axis makes the rotation appear counterclockwise.
| angle | the amount to rotate. |
Creates a new rotation matrix around the z-axis.
Note: the rotation happens counterclockwise. Looking towards negative infinity on the z-axis makes the rotation appear counterclockwise.
| angle | the amount to rotate. |
|
static |
Creates a new scaling matrix in all 3 dimensions.
| scalar | the amount to scale. |
|
static |
Creates a new scaling matrix.
| x | the amount to scale on the x-axis. |
| y | the amount to scale on the y-axis. |
| z | the amount to scale on the z-axis. |
| void luciad::Matrix4x4::setValue | ( | size_t | column, |
| size_t | row, | ||
| double | value ) |
Sets the value at the given column and row.
| column | the column. |
| row | the row. |
| value | the value. |
Returns the difference of two matrices.
| other | the other matrix. |
| Coordinate luciad::Matrix4x4::transformPoint | ( | const Coordinate & | point | ) | const |
Applies this matrix as an affine transformation to a point.
This method does the same as the multiply operator.
| point | the point. |
| Coordinate luciad::Matrix4x4::transformVector | ( | const Coordinate & | vector | ) | const |
Applies this matrix as an affine transformation to a vector.
Note: the main difference between transformVector and transformPoint is that transformVector does NOT apply translations, whereas transformPoint does.
| vector | the vector. |
|
static |
Creates a new translation matrix.
| translation | the translation. |
|
static |
Creates a new translation matrix.
| x | the translation on the x-axis. |
| y | the translation on the y-axis. |
| z | the translation on the z-axis. |
| Matrix4x4 luciad::Matrix4x4::transpose | ( | ) | const |
Returns the transpose of this matrix.