# shz_quat_t

Source: https://sh4zam.com/api/quat/shz_quat_t/

```c
typedef struct shz_quat {
    union {           //!< Convenience anonymous union between named and array-indexed components.
        struct {      //!< Anonymous structure with named components.
            float w;             //!< W or scalar component/real part of quaternion.
            union {   //!< Convenience anonymous union for vector components.
                struct {
                    float x;     //!< X component of axis of rotation (imaginary)
                    float y;     //!< Y component of axis of rotation (imaginary)
                    float z;     //!< Z component of axis of rotation (imaginary)
                };
                shz_vec3_t axis; //!< 3D vector representing axis of rotation
            };
        };
        float e[4];              //!< Array-indexed components.
    };
} shz_quat_t;
```

Represents a 3D quaternion.

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `e` | `float[4]` | Array-indexed components. |
| `w` | `float` | \< Anonymous structure with named components. |
| `axis` | `shz_vec3_t` | 3D vector representing axis of rotation |
| `x` | `float` | X component of axis of rotation (imaginary). |
| `y` | `float` | Y component of axis of rotation (imaginary). |
| `z` | `float` | Z component of axis of rotation (imaginary). |

## Details

Quaternions are a mathematical structure representing a rotation about a single arbitrary axis.

## Availability

- **C++ equivalent:** [`shz::quat`](https://sh4zam.com/api/cpp/quat/)
- **Back-ends:** n/a (not a function)
- **Defined in:** [`sh4zam/shz_quat.h:31`](https://github.com/gyrovorbis/sh4zam/blob/ba1e30c88d49df0311870b229e1dd860ef26c477/include/sh4zam/shz_quat.h#L31)
- **Module:** [Quaternion](https://sh4zam.com/api/quat/), section "Types"
