|
Jameo Core Library
|
An m x n-dimensional matrix. More...
Public Member Functions | |
| Matrix (size_t rows, size_t cols) | |
| This constructor creates a matrix and initializes it with zeros. | |
| Matrix (const Vertex3 &c1, const Vertex3 &c2, const Vertex3 &c3, bool rowwise) | |
| Special constructor for a 3x3 matrix. | |
| Matrix ()=default | |
| Default constructor. | |
| Matrix (double value) | |
| Constructor sets up a matrix 1x1 with the numerical value as entry,. | |
| Matrix (const Matrix &other) | |
| Copy constructor. | |
| Matrix (const Matrix *other) | |
| Copy constructor. | |
| virtual | ~Matrix () |
| Destructor. | |
| void | set (size_t row, size_t col, double value) |
| Sets the value of a cell. | |
| void | add (size_t row, size_t col, double value) |
| Adds to the value of a cell the passed value. | |
| double | get (size_t row, size_t col) const |
| Returns the value of a cell. | |
| void | zeros () |
| This method fills all elements of the matrix with 0. | |
| void | transpose () |
| This method transposes the matrix,. | |
| void | insert (const Matrix &A) |
| This method inserts the contents of the other matrix into this matrix. Upper left element is 0,0. | |
| void | insert (const Matrix &A, size_t r, size_t c) |
| This method inserts the contents of the Other matrix into this matrix. Upper left element is r,c. | |
| void | diag (double value) |
| This method sets all values on the diagonal elements to the desired value. | |
| Status | det (double &det) const |
| Calculates the determinant of a matrix. | |
| Status | inverse () |
| Inverts this matrix. | |
| const double * | ref () const |
| This method returns the reference to the data array. | |
| double | norm (MatrixNorm norm) const |
| This method calculates the condition of the matrix according to the corresponding matrix norm. | |
| double | trace () const |
| Returns the sum of the diagonal elements. | |
| Vector | eigen () const |
| Returns the Eigen Values of the matrix. | |
| void | print () const |
Prints the content of the matrix on std::cout. | |
| size_t | nonZeroElementCount () const |
| This method calculates the number of elements that are not 0.0. Currently this is done without EPS. | |
| void | initIdentity () |
| Initializes this transformation as an identity matrix. | |
| void | initWcs (const Vertex3 &extrusion) |
| Initializes this matrix as a World Coordinate System (WCS) matrix. | |
| void | initMirroring (const Vertex3 &planePoint, const Vertex3 &planeNormal) |
| Initializes this matrix as a mirroring matrix. | |
| void | initMoving (const Vertex3 &distance) |
| Initializes this matrix as a translation matrix. | |
| void | initScaling (const Vertex3 &factors) |
| Initializes this transformation as scaling by different factors along the x, y, and z axes. | |
| void | initScaling (const Vertex3 &basePoint, double factor) |
| Initializes this transformation as scaling around a base point. | |
| void | initRotationZ (double angle) |
| Initializes this Transform as a rotation matrix around the Z-axis. | |
| void | initRotation (const Vertex3 &axisPoint, const Vertex3 &axisDirection, double angle) |
| Initializes this Transform as a rotation matrix. | |
| void | initLookAt (const jm::Vertex3 &camera, const jm::Vertex3 ¢er, const jm::Vertex3 &up) |
| Initialize this matrix as a "look-at" matrix. | |
| Vertex3 | trans (const Vertex3 &vertex) const |
| This method transforms the vertex using the 4x4 transformation matrix. | |
| double | trans (double value) const |
| This method transforms the number using the 4x4 transformation matrix. X value is used. | |
| double | transAngle (double angle) const |
| Transform a rotation angle about the Z-Axis of LCS as usually needed by arcs or texts. | |
| Matrix & | operator= (const Matrix &A) |
| size_t | rows () const |
| This method returns the number of rows. | |
| size_t | cols () const |
| This method returns the number of columns. | |
Static Public Member Functions | |
| static Matrix | generate3x3RotationMatrix (double angle, const Vertex3 &axis) |
| This static function generates a 3x3 rotation matrix. | |
| static Matrix | generate3x3RotationXMatrix (double angle) |
| This static function generates a 3x3 rotation matrix for a rotation around the X-axis. | |
| static Matrix | generate3x3RotationYMatrix (double angle) |
| This static function generates a 3x3 rotation matrix for a rotation around the Y-axis. | |
| static Matrix | generate3x3RotationZMatrix (double angle) |
| This static function generates a 3x3 rotation matrix for a rotation around the Z-axis. | |
| static Matrix | generate3x3RotationMatrix (const Vertex3 &u, const Vertex3 &v) |
| This static function generates a 3x3 rotation matrix for a rotation from vector u to vector v. | |
Friends | |
| DllExport friend Matrix | operator* (const Matrix &A, const Matrix &B) |
| Implementation of the operator M * M (matrix multiplication). | |
| DllExport friend Matrix | operator* (const double &d, const Matrix &b) |
| Implementation of the operator d * M (scalar multiplication). | |
| DllExport friend Vertex3 | operator* (const Matrix &A, const Vertex3 &b) |
| Implementation of the operator M * v (matrix multiplication with a vector). The matrix must be 3x3. | |
| DllExport friend Matrix | operator+ (const Matrix &A, const Matrix &B) |
| Implementation of the operator M + M (matrix addition). | |
| DllExport friend Matrix | operator- (const Matrix &A, const Matrix &B) |
| Implementation of the operator M - M (matrix subtraction). | |
| DllExport friend Matrix | operator/ (const Matrix &A, const double &d) |
| Implementation of the operator M / d (scalar division). | |
An m x n-dimensional matrix.
| jm::Matrix::Matrix | ( | size_t | rows, |
| size_t | cols | ||
| ) |
This constructor creates a matrix and initializes it with zeros.
| rows | Number of rows. |
| cols | Number of columns. |
Special constructor for a 3x3 matrix.
| c1 | The 1st column of the matrix |
| c2 | The 2nd column of the matrix |
| c3 | The 3rd column of the matrix |
| rowwise | if true, then the matrix is filled row by row otherwise column by column. |
|
default |
Default constructor.
|
explicit |
Constructor sets up a matrix 1x1 with the numerical value as entry,.
| jm::Matrix::Matrix | ( | const Matrix & | other | ) |
Copy constructor.
| jm::Matrix::Matrix | ( | const Matrix * | other | ) |
Copy constructor.
|
virtual |
Destructor.
| void jm::Matrix::add | ( | size_t | row, |
| size_t | col, | ||
| double | value | ||
| ) |
Adds to the value of a cell the passed value.
| row | The 0-based index of the row. |
| col | The 0-based index of the column. |
| value | The value to be added to the cell. |
| size_t jm::Matrix::cols | ( | ) | const |
This method returns the number of columns.
| Status jm::Matrix::det | ( | double & | det | ) | const |
Calculates the determinant of a matrix.
This method is currently limited to a maximum of 4x4 matrices.
| void jm::Matrix::diag | ( | double | value | ) |
This method sets all values on the diagonal elements to the desired value.
| Vector jm::Matrix::eigen | ( | ) | const |
Returns the Eigen Values of the matrix.
Currentrly this is restricted to matrices of maximum 3x3.
This static function generates a 3x3 rotation matrix for a rotation from vector u to vector v.
| u | The start vector |
| v | The end vector |
This static function generates a 3x3 rotation matrix.
| angle | Angle of rotation in radians |
| axis | Rotation axis (must be normalized) |
|
static |
This static function generates a 3x3 rotation matrix for a rotation around the X-axis.
| angle | Angle of rotation in radians |
|
static |
This static function generates a 3x3 rotation matrix for a rotation around the Y-axis.
| angle | Angle of rotation in radians |
|
static |
This static function generates a 3x3 rotation matrix for a rotation around the Z-axis.
| angle | Angle of rotation in radians |
| double jm::Matrix::get | ( | size_t | row, |
| size_t | col | ||
| ) | const |
Returns the value of a cell.
| row | The 0-based index of the row. |
| col | The 0-based index of the column. |
| void jm::Matrix::initIdentity | ( | ) |
Initializes this transformation as an identity matrix.
An identity matrix is a square matrix in which all the elements of the principal diagonal are ones and all other elements are zeros. When a vector or point is multiplied by an identity matrix, the result is the same vector or point. This method sets the transformation matrix to an identity matrix, effectively resetting any previous transformations applied.
| void jm::Matrix::initLookAt | ( | const jm::Vertex3 & | camera, |
| const jm::Vertex3 & | center, | ||
| const jm::Vertex3 & | up | ||
| ) |
Initialize this matrix as a "look-at" matrix.
| camera | The camera position |
| center | The "target" center of the view |
| up | The up vector (needed for rotation) |
Initializes this matrix as a mirroring matrix.
| planePoint | The point on the mirror plane. |
| planeNormal | The normal vector of the mirror plane. |
This method initializes the transformation matrix as a mirroring matrix, which reflects points across a mirror plane. The mirror plane is defined by a point on the plane (planePoint) and the normal vector of the plane (planeNormal). The resulting matrix can be used to mirror 3D points and objects.
| void jm::Matrix::initMoving | ( | const Vertex3 & | distance | ) |
Initializes this matrix as a translation matrix.
| distance | The distance to translate by. |
| void jm::Matrix::initRotation | ( | const Vertex3 & | axisPoint, |
| const Vertex3 & | axisDirection, | ||
| double | angle | ||
| ) |
Initializes this Transform as a rotation matrix.
| axisPoint | The origin vector of the rotation axis. |
| axisDirection | The normalized direction vector of the rotation axis. |
| angle | The rotation angle in radians. |
| void jm::Matrix::initRotationZ | ( | double | angle | ) |
Initializes this Transform as a rotation matrix around the Z-axis.
| angle | The rotation angle in radians. |
| void jm::Matrix::initScaling | ( | const Vertex3 & | basePoint, |
| double | factor | ||
| ) |
Initializes this transformation as scaling around a base point.
| basePoint | The point around which the scaling is performed. |
| factor | The scaling factor. |
| void jm::Matrix::initScaling | ( | const Vertex3 & | factors | ) |
Initializes this transformation as scaling by different factors along the x, y, and z axes.
| factors | The scaling factors along the x, y, and z axes. |
| void jm::Matrix::initWcs | ( | const Vertex3 & | extrusion | ) |
Initializes this matrix as a World Coordinate System (WCS) matrix.
| extrusion | The extrusion vector used for the transformation. |
This method initializes the transformation matrix as a WCS matrix, which represents the coordinate system transformation from Object Coordinate System (OCS) to WCS. The extrusion vector is used to define the direction of the Z-axis in the WCS. The resulting matrix can be used to transform 3D points and angles from OCS to WCS.
| void jm::Matrix::insert | ( | const Matrix & | A | ) |
This method inserts the contents of the other matrix into this matrix. Upper left element is 0,0.
| void jm::Matrix::insert | ( | const Matrix & | A, |
| size_t | r, | ||
| size_t | c | ||
| ) |
This method inserts the contents of the Other matrix into this matrix. Upper left element is r,c.
| Status jm::Matrix::inverse | ( | ) |
Inverts this matrix.
This method is currently limited to a maximum of 4x4 matrices.
| size_t jm::Matrix::nonZeroElementCount | ( | ) | const |
This method calculates the number of elements that are not 0.0. Currently this is done without EPS.
| double jm::Matrix::norm | ( | MatrixNorm | norm | ) | const |
This method calculates the condition of the matrix according to the corresponding matrix norm.
| void jm::Matrix::print | ( | ) | const |
Prints the content of the matrix on std::cout.
| const double * jm::Matrix::ref | ( | ) | const |
This method returns the reference to the data array.
Only needed for efficient access for OpenGL.
| size_t jm::Matrix::rows | ( | ) | const |
This method returns the number of rows.
| void jm::Matrix::set | ( | size_t | row, |
| size_t | col, | ||
| double | value | ||
| ) |
Sets the value of a cell.
| row | The 0-based index of the row. |
| col | The 0-based index of the column. |
| value | The value of the cell. |
| double jm::Matrix::trace | ( | ) | const |
Returns the sum of the diagonal elements.
This method transforms the vertex using the 4x4 transformation matrix.
| vertex | The input vertex to be transformed. |
| double jm::Matrix::trans | ( | double | value | ) | const |
This method transforms the number using the 4x4 transformation matrix. X value is used.
| value | The input number to be transformed. |
| double jm::Matrix::transAngle | ( | double | angle | ) | const |
Transform a rotation angle about the Z-Axis of LCS as usually needed by arcs or texts.
| angle | Rotation angle in radians. |
| void jm::Matrix::transpose | ( | ) |
This method transposes the matrix,.
| void jm::Matrix::zeros | ( | ) |
This method fills all elements of the matrix with 0.
Implementation of the operator d * M (scalar multiplication).
Implementation of the operator M * M (matrix multiplication).
Implementation of the operator M * v (matrix multiplication with a vector). The matrix must be 3x3.
Implementation of the operator M + M (matrix addition).
Implementation of the operator M - M (matrix subtraction).