# shz_mat4x4_inverse_rigid

Source: https://sh4zam.com/api/matrix/shz_mat4x4_inverse_rigid/

```c
SHZ_INLINE void shz_mat4x4_inverse_rigid(const shz_mat4x4_t* mtx, shz_mat4x4_t* out) SHZ_NOEXCEPT;
```

Computes the inverse of a rigid 4x4 transform matrix.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `mtx` | `const shz_mat4x4_t *` |  |
| `out` | `shz_mat4x4_t *` |  |

## Returns

Nothing (`void`).

## Details

`mtx` must be a rigid affine transform \[R t; 0 1\], where R is orthonormal. The result, \[transpose(R), -transpose(R) \* t; 0 1\], is computed by transposing R rather than by a general inversion, making this far cheaper than `shz_mat4x4_inverse()`.

## Notes

- `shz_mat4x4_inverse()` does not dynamically check whether to use this optimization.

## Warnings

- Scale, shear, and projective matrices are not inverted correctly. Use `shz_mat4x4_inverse()` for those.
- This routine clobbers XMTRX.

## Naming and requirements

- `shz_mat4x4_t` and `shz_mat2x2_t` arguments must be 8-byte aligned. Unaligned data goes through the `float[16]` parameters of the `_unaligned` routines.

## Availability

- **C++ equivalent:** [`shz::mat4x4::inverse_rigid`](https://sh4zam.com/api/cpp/mat4x4/#inverse_rigid)
- **Type-generic form:** none
- **Back-ends:** SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_matrix.h:1114`](https://github.com/gyrovorbis/sh4zam/blob/6b22b851ad9ca109049f956dbbbecf7c519c959f/include/sh4zam/shz_matrix.h#L1114)
- **Module:** [Matrix](https://sh4zam.com/api/matrix/), section "Miscellaneous"

## See also

[`shz_xmtrx_invert_rigid`](https://sh4zam.com/api/xmtrx/shz_xmtrx_invert_rigid/), [`shz_mat4x4_inverse_block_triangular`](https://sh4zam.com/api/matrix/shz_mat4x4_inverse_block_triangular/)
