# Module /mat

4x4 floating-point matrix math (Mat4) for 3D transforms, projections, rotations, and inversions.

```tangu
(use /mat)
```

## Functions & symbols

### *

`(* a b) -> Mat4`

Matrix multiplication (4x4 * 4x1) = 4x1

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `m` | `Mat4` | no | — |
| `v` | `(Array Any)` | no | — |

### Mat4

`(Mat4 r1 r2 r3 r4)`

Constructs a 4x4 matrix from 4 row vectors `[r1 r2 r3 r4]`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `r1` | `Any` | no | — |
| `r2` | `Any` | no | — |
| `r3` | `Any` | no | — |
| `r4` | `Any` | no | — |

### Mat4-one

`(Mat4-one angle)`

Constructs the 4x4 identity matrix.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `angle` | `Any` | no | — |

### Mat4-projection

`(Mat4-projection fov aspect near far)`

Constructs a symmetric 4x4 perspective projection matrix (`fov` in radians, `aspect`, `near`, `far`).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `fov` | `Any` | no | — |
| `aspect` | `Any` | no | — |
| `near` | `Any` | no | — |
| `far` | `Any` | no | — |

### Mat4-rotation-x

`(Mat4-rotation-x angle)`

Constructs a 4x4 X-axis rotation matrix for `angle` in radians.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `angle` | `Any` | no | — |

### Mat4-rotation-y

`(Mat4-rotation-y angle)`

Constructs a 4x4 Y-axis rotation matrix for `angle` in radians.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `angle` | `Any` | no | — |

### Mat4-rotation-z

`(Mat4-rotation-z angle)`

Constructs a 4x4 Z-axis rotation matrix for `angle` in radians.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `angle` | `Any` | no | — |

### Mat4-translation

`(Mat4-translation tx ty tz)`

Constructs a 4x4 translation matrix shifting by `(tx, ty, tz)`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `tx` | `Any` | no | — |
| `ty` | `Any` | no | — |
| `tz` | `Any` | no | — |

### Mat4-zero

`(Mat4-zero angle)`

Constructs the 4x4 zero matrix.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `angle` | `Any` | no | — |

### put

`(put m i j value) -> None`

Sets the scalar entry at row `i`, column `j` of matrix `m` to `value` in place.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `m` | `Mat4` | no | — |
| `i` | `Int` | no | — |
| `j` | `Int` | no | — |
| `value` | `Float` | no | — |
