# shz_xmtrx_init_rotation_dir

Source: https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_dir/

> Initializes XMTRX to contain a 3D rotation matrix of angle radians about the given axis

```c
SHZ_INLINE void shz_xmtrx_init_rotation_dir(float angle, float x, float y, float z) SHZ_NOEXCEPT;
```

Initializes XMTRX to contain a 3D rotation matrix of `angle` radians about the given `axis`.

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `angle` | `float` |  |
| `x` | `float` |  |
| `y` | `float` |  |
| `z` | `float` |  |

## Returns

Nothing (`void`).

## Details

This is a faster version of `shz_xmtrx_init_rotation()` or glRotatef() which requires being passed a unit vector for the rotation axis.

## Warnings

- The vector components representing the axis of rotation must be prenormalized!

## Availability

- **C++ equivalent:** [`shz::xmtrx::init_rotation_dir`](https://sh4zam.com/api/cpp/xmtrx/#init_rotation_dir)
- **Type-generic form:** none
- **Back-ends:** SH4: dedicated SH4 implementation · SW: portable C · SPU: shared C implementation
- **Defined in:** [`sh4zam/shz_xmtrx.h:329`](https://github.com/gyrovorbis/sh4zam/blob/ba1e30c88d49df0311870b229e1dd860ef26c477/include/sh4zam/shz_xmtrx.h#L329)
- **Module:** [XMTRX](https://sh4zam.com/api/xmtrx/), section "Initialization"

## See also

[`shz_xmtrx_init_rotation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation/)
