shz_mat3x3_adjugate
SHZ_INLINE void shz_mat3x3_adjugate(const shz_mat3x3_t* mat, shz_mat3x3_t* out) SHZ_NOEXCEPT;Computes the adjugate of a 3x3 matrix.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
mat | const shz_mat3x3_t * | Pointer to the 3x3 matrix whose adjugate is computed. |
out | shz_mat3x3_t * | Pointer to the resulting adjugate matrix. |
Returns
Section titled “Returns”Nothing (void).
Details
Section titled “Details”The adjugate is the inverse scaled by the determinant: adj(M) = det(M) * M^-1. It is defined for every matrix, including singular ones, and saves cycles over shz_mat3x3_inverse() by not computing or dividing by the determinant.
- The transpose of the adjugate shares the direction of the inverse-transpose normal matrix, so it can be used to transform normals that are renormalized afterwards, even under non-uniform scale. A negative determinant flips them.
Warnings
Section titled “Warnings”- This routine clobbers XMTRX.
Availability
Section titled “Availability”- C++ equivalent: none (call the C function from C++)
- Type-generic form: none
- Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- Defined in:
sh4zam/shz_matrix.h:1233 - Module: Matrix, section "Functions"