Implement missing Matrix members
All checks were successful
Run tests / Explore-Gitea-Actions (push) Successful in 1m13s
Build Docs With Doxygen / Explore-Gitea-Actions (push) Successful in 31s

This commit is contained in:
2024-05-27 16:27:21 -04:00
parent ff777d1867
commit 201fb4a28d
4 changed files with 106 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
#include <J3ML/LinearAlgebra/Vector2.h>
#include <J3ML/LinearAlgebra/Vector3.h>
#include <J3ML/LinearAlgebra/Quaternion.h>
#include <cstring>
namespace J3ML::LinearAlgebra {
@@ -47,7 +48,7 @@ namespace J3ML::LinearAlgebra {
@param m The matrix to store the result.
@param angle The rotation angle in radians. */
template <typename Matrix>
void Set3x3RotatePartZ(Matrix &m, float angle)
void Set3x3PartRotateZ(Matrix &m, float angle)
{
float sinz, cosz;
sinz = std::sin(angle);
@@ -274,7 +275,6 @@ namespace J3ML::LinearAlgebra {
/// Sets this matrix to equal the identity.
void SetIdentity();
void SwapColumns(int col1, int col2);
void SwapRows(int row1, int row2);
@@ -291,7 +291,7 @@ namespace J3ML::LinearAlgebra {
/// Sets all values of this matrix.
/// @param valuesThe values in this array will be copied over to this matrix. The source must contain 9 floats in row-major order
/// (the same order as the Set() function aove has its input parameters in).
void Set(const float *values);
void Set(const float *p);
/// Orthonormalizes the basis formed by the column vectors of this matrix.
void Orthonormalize(int c0, int c1, int c2);
@@ -383,8 +383,16 @@ namespace J3ML::LinearAlgebra {
void InverseOrthonormal();
/// Inverts a symmetric matrix.
/** This function is faster than directly calling Inverse()
This function computes 6 LOADs, 9 STOREs, 21 MULs, 1 DIV, 1 CMP, and 8 ADDs.
@return True if computing the inverse succeeded, false otherwise (determinant was zero).
@note If this function fails, the original matrix is not modified.
@note This function operates in-place. */
bool InverseSymmetric();
/// Transposes this matrix.
/// This operation swaps all elements with respect to the diagonal.
void Transpose();