# shz_vec3_rotate_dir

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

> Rotates the given 3D vector by angle radians about the given unit-length axis

```c
SHZ_INLINE shz_vec3_t shz_vec3_rotate_dir(shz_vec3_t vec, float angle, shz_vec3_t axis) SHZ_NOEXCEPT;
```

Rotates the given 3D vector by `angle` radians about the given unit-length axis.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `vec` | `shz_vec3_t` | The vector to rotate. |
| `angle` | `float` | Angle of rotation, in radians. |
| `axis` | `shz_vec3_t` | Unit-length axis of rotation. |

## Returns

`vec` rotated by `angle` about `axis`.

## Details

This is a faster version of `shz_vec3_rotate()` which skips normalizing the axis of rotation.

## Warnings

- The axis of rotation must be prenormalized!
- This routine should only be used for one-off rotations of a single vector. To rotate multiple vectors in a batch, use the XMTRX API.

## Availability

- **C++ equivalent:** none (call the C function from C++)
- **Type-generic form:** none
- **Back-ends:** SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_vector.h:1143`](https://github.com/gyrovorbis/sh4zam/blob/6b22b851ad9ca109049f956dbbbecf7c519c959f/include/sh4zam/shz_vector.h#L1143)
- **Module:** [Vector](https://sh4zam.com/api/vector/), section "Rotations"

## See also

[`shz_vec3_rotate`](https://sh4zam.com/api/vector/shz_vec3_rotate/), [`shz_xmtrx_init_rotation_dir`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_dir/)
