# shz_vec2_clamp

Source: https://sh4zam.com/api/vector/shz_vec2_clamp/

> Clamps the values of the given 2D vec between min and max, returning a new vector

```c
SHZ_INLINE shz_vec2_t shz_vec2_clamp(shz_vec2_t vec, float min, float max) SHZ_NOEXCEPT;
```

Clamps the values of the given 2D `vec` between `min` and `max`, returning a new vector.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vec` | `shz_vec2_t` |  |
| `min` | `float` |  |
| `max` | `float` |  |

## Returns

`shz_vec2_t`

## Availability

- **C++ equivalent:** [`shz::vec2::clamp`](https://sh4zam.com/api/cpp/vec2/#clamp)
- **Type-generic form:** [`shz_vec_clamp()`](https://sh4zam.com/api/vector/shz_vec_clamp/)
- **Back-ends:** SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_vector.h:183`](https://github.com/gyrovorbis/sh4zam/blob/ba1e30c88d49df0311870b229e1dd860ef26c477/include/sh4zam/shz_vector.h#L183)
- **Module:** [Vector](https://sh4zam.com/api/vector/), section "Component-wise Operations"
