SaturnRingLibrary 0.9.1
SGL wrapper
 
Loading...
Searching...
No Matches

◆ TryInverse()

bool constexpr SRL::Math::Types::Matrix33::TryInverse ( Matrix33 & out) const
inlineconstexprinherited

Attempt to compute the inverse of the matrix.

Computes the inverse matrix if possible. A matrix is invertible if and only if its determinant is non-zero. The inverse of a transformation matrix represents the opposite transformation.

The inverse is computed using the adjugate matrix method:

  1. Calculate the determinant
  2. If determinant is non-zero:
    • Compute the matrix of cofactors
    • Transpose to get the adjugate matrix
    • Multiply by 1/determinant
Parameters
outThe resulting inverse matrix if successful.
Returns
True if matrix was invertible (det ≠ 0), false otherwise.
Note
For orthogonal matrices (like pure rotation matrices), the inverse is equal to the transpose.
Matrix33 inverse;
if (transform.TryInverse(inverse)) {
// inverse * transform ≈ Identity
}
static consteval Angle FromDegrees(double degrees)
Creates angle from degrees at compile time.
Definition angle.hpp:204
bool constexpr TryInverse(Matrix33 &out) const
Attempt to compute the inverse of the matrix.
Definition mat33.hpp:641
constexpr Matrix33()
Default constructor initializing to a zero matrix.
Definition mat33.hpp:76
static constexpr Matrix33 CreateRotationY(const Angle &angle)
Create a new Y-axis rotation matrix.
Definition mat33.hpp:398