# Module /vec

2D, 3D, and 4D Euclidean vector math (Vec2, Vec3, Vec4): dot product, cross product, normalization, and distance.

```tangu
(use /vec)
```

## Structs

### Vec2

`Struct` in `/vec`

2D vector with `#Float` components.

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `x` | `Float` | `—` | — |
| `y` | `Float` | `—` | — |

### Vec3

`Struct` in `/vec`

3D vector with `#Float` components.

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `x` | `Float` | `—` | — |
| `y` | `Float` | `—` | — |
| `z` | `Float` | `—` | — |

### Vec4

`Struct` in `/vec`

4D homogeneous vector with `#Float` components.

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `x` | `Float` | `—` | — |
| `y` | `Float` | `—` | — |
| `z` | `Float` | `—` | — |
| `t` | `Float` | `—` | — |

## Traits

### Vec

`Trait` in `/vec`

Algebraic vector trait for N-dimensional `#Float` Structs.
Automatically implemented via `(derive T Vec)`.

- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 
- `` — 

## Functions & symbols

### cross

`(cross a b) -> Float`

Computes the 3D cross product in homogeneous 4D coordinates (t = 0.0).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `a` | `Vec4` | no | — |
| `b` | `Vec4` | no | — |

### perp

`(perp v)`

Returns the 2D perpendicular vector `(-y, x)` (90-degree counterclockwise rotation).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `v` | `Vec2` | no | — |
