# Cheatsheet

Source: https://sh4zam.com/cheatsheet/

> The whole SH4ZAM C API on one page: every symbol with its signature and a one-line description

Every public SH4ZAM 0.9.1 symbol on one page. Conventions: column-major matrices, quaternions stored `<W, X, Y, Z>`, radians by default, single-precision `float` only. C++ names drop the `shz_` prefix and live in `namespace shz`; see the [C++ API](https://sh4zam.com/api/cpp/).

## Scalar

`#include <sh4zam/shz_scalar.h>` · [module page](https://sh4zam.com/api/scalar/)

### Scalar: Comparisons

- [`shz_fminf`](https://sh4zam.com/api/scalar/shz_fminf/): `float shz_fminf(float a, float b)` Returns the minimum value of two given floats.
- [`shz_fmaxf`](https://sh4zam.com/api/scalar/shz_fmaxf/): `float shz_fmaxf(float a, float b)` Returns the maximum value of two given floats.
- [`shz_equalf`](https://sh4zam.com/api/scalar/shz_equalf/): `bool shz_equalf(float a, float b)` Checks for equality based on EITHER the absolute tolerance or relative tolerance, using `SHZ_FLT_EPSILON`.
- [`shz_equalf_abs`](https://sh4zam.com/api/scalar/shz_equalf_abs/): `bool shz_equalf_abs(float a, float b)` Checks for equality based on the absolute tolerance using `SHZ_FLT_EPSILON`.
- [`shz_equalf_rel`](https://sh4zam.com/api/scalar/shz_equalf_rel/): `bool shz_equalf_rel(float a, float b)` Checks for equality based on the relative tolerance using `SHZ_FLT_EPSILON`.

### Scalar: Rounding

- [`shz_floorf`](https://sh4zam.com/api/scalar/shz_floorf/): `float shz_floorf(float x)` Replacement for the \<math.h> routine, floorf().
- [`shz_ceilf`](https://sh4zam.com/api/scalar/shz_ceilf/): `float shz_ceilf(float x)` Replacement for the \<math.h> routine, ceilf().
- [`shz_roundf`](https://sh4zam.com/api/scalar/shz_roundf/): `float shz_roundf(float x)` Replacement for the \<math.h> routine, roundf().
- [`shz_truncf`](https://sh4zam.com/api/scalar/shz_truncf/): `float shz_truncf(float x)` Replacement for the \<math.h> routine, truncf().
- [`shz_remainderf`](https://sh4zam.com/api/scalar/shz_remainderf/): `float shz_remainderf(float num, float denom)` Replacement for the \<math.h> routine, remainderf().
- [`shz_fmodf`](https://sh4zam.com/api/scalar/shz_fmodf/): `float shz_fmodf(float num, float denom)` Replacement for the \<math.h> routine, fmodf().
- [`shz_remquof`](https://sh4zam.com/api/scalar/shz_remquof/): `float shz_remquof(float num, float denom, float* quot)` (Sorta) Replacement for the \<math.h> routine, remquof().

### Scalar: Mapping

- [`shz_clampf`](https://sh4zam.com/api/scalar/shz_clampf/): `float shz_clampf(float value, float min, float max)` Clamps a floating-point value by the given `min` and `max` values.
- [`shz_normalizef`](https://sh4zam.com/api/scalar/shz_normalizef/): `float shz_normalizef(float current, float from, float to)` Maps a value within the given range `from` to `to`, to be within the range of `0.0f += 1.0f`.
- [`shz_normalizef_fsrra`](https://sh4zam.com/api/scalar/shz_normalizef_fsrra/): `float shz_normalizef_fsrra(float current, float from, float to)` Maps a value within the given range `from` to `to`, to be within the range of `0.0f + 1.0f` more quickly, provided `to` - `from` is a positive difference.
- [`shz_remapf`](https://sh4zam.com/api/scalar/shz_remapf/): `float shz_remapf(float value, float inputStart, float inputEnd, float outputStart, float outputEnd)` Maps a value within the given range `inputStart` to `inputEnd`, to be within the range of `outputStart` to `outputEnd`.
- [`shz_remapf_fsrra`](https://sh4zam.com/api/scalar/shz_remapf_fsrra/): `float shz_remapf_fsrra(float value, float inputStart, float inputEnd, float outputStart, float outputEnd)` Maps a value within the given range `inputStart` to `inputEnd`, to be within the range of `outputStart` to `outputEnd` more quickly, provided the `outputEnd` - `outputStart` is a positive difference.
- [`shz_wrapf`](https://sh4zam.com/api/scalar/shz_wrapf/): `float shz_wrapf(float value, float min, float max)` Wraps the given `value` back to be within the range of `min` to `max`.
- [`shz_wrapf_fsrra`](https://sh4zam.com/api/scalar/shz_wrapf_fsrra/): `float shz_wrapf_fsrra(float value, float min, float max)` Wraps the given `value` back to be within the range of `min` to `max` more quickly, provided `max` - `min` is a positive difference.
- [`shz_fractf`](https://sh4zam.com/api/scalar/shz_fractf/): `float shz_fractf(float x)` Returns the fractional part of `x`, equivalent to GLSL `fract()`.
- [`shz_signf`](https://sh4zam.com/api/scalar/shz_signf/): `float shz_signf(float x)` Returns -1.0f if `x` \< 0, 0.0f if `x` == 0, or 1.0f if `x` > 0.
- [`shz_saturatef`](https://sh4zam.com/api/scalar/shz_saturatef/): `float shz_saturatef(float x)` Clamps `x` to the range \[0.0f, 1.0f\].

### Scalar: Miscellaneous

- [`shz_fabsf`](https://sh4zam.com/api/scalar/shz_fabsf/): `float shz_fabsf(float x)` Replacement for the \<math.h> routine, fabsf().
- [`shz_copysignf`](https://sh4zam.com/api/scalar/shz_copysignf/): `float shz_copysignf(float x, float y)` Replacement for the \<math.h> routine, copysignf().
- [`shz_fmaf`](https://sh4zam.com/api/scalar/shz_fmaf/): `float shz_fmaf(float a, float b, float c)` Replacement for the \<math.h> routine, fmaf().
- [`shz_fdimf`](https://sh4zam.com/api/scalar/shz_fdimf/): `float shz_fdimf(float x, float y)` Replacement for the \<math.h> routine, fdimf(),.
- [`shz_hypotf`](https://sh4zam.com/api/scalar/shz_hypotf/): `float shz_hypotf(float x, float y)` Replacement for the \<math.h> routine, hypotf().
- [`shz_cbrtf`](https://sh4zam.com/api/scalar/shz_cbrtf/): `float shz_cbrtf(float x)` Replacement for the \<math.h> routine, cbrtf().
- [`shz_lerpf`](https://sh4zam.com/api/scalar/shz_lerpf/): `float shz_lerpf(float a, float b, float t)` Returns a value that is linearly interpolated between `a` and `b` by the given ratio, `t`.
- [`shz_barycentric_lerpf`](https://sh4zam.com/api/scalar/shz_barycentric_lerpf/): `float shz_barycentric_lerpf(float a, float b, float c, float u, float v)` Returns a value that is barycentrically interpolated between `a`, `b`, and `c` using the given barycentric coordinates, `u` and `v`.
- [`shz_quadratic_roots`](https://sh4zam.com/api/scalar/shz_quadratic_roots/): `bool shz_quadratic_roots(float a, float b, float c, float* root1, float* root2)` Uses the quadratic formula with the given coefficients to solve for the two roots, returning `true` if any real roots exist, and `false` if the roots are only imaginary.
- [`shz_randf`](https://sh4zam.com/api/scalar/shz_randf/): `float shz_randf(int* seed)` Returns a random floating-point number between `0.0f` and `1.0f`, using and updating the given seed.
- [`shz_randf_range`](https://sh4zam.com/api/scalar/shz_randf_range/): `float shz_randf_range(int* seed, float min, float max)` Returns a random floating-point number between `min` and `max`, using and updating the given seed.
- [`shz_stepf`](https://sh4zam.com/api/scalar/shz_stepf/): `float shz_stepf(float x, float edge)` returns 0.0f if x \< edge, otherwise 1.0f
- [`shz_smoothstepf`](https://sh4zam.com/api/scalar/shz_smoothstepf/): `float shz_smoothstepf(float x, float edge0, float edge1)` Returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. edge0 must be less than edge1 or result is undefined.
- [`shz_smoothstepf_safe`](https://sh4zam.com/api/scalar/shz_smoothstepf_safe/): `float shz_smoothstepf_safe(float x, float edge0, float edge1)` Returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. Accepts inverse edges.

### Scalar: FSRRA

- [`shz_inv_sqrtf_fsrra`](https://sh4zam.com/api/scalar/shz_inv_sqrtf_fsrra/): `float shz_inv_sqrtf_fsrra(float x)` Calculates 1.0f/sqrtf( `x`), using a fast approximation.
- [`shz_inv_sqrtf`](https://sh4zam.com/api/scalar/shz_inv_sqrtf/): `float shz_inv_sqrtf(float x)` Calculates 1.0f/sqrtf( `x` ), using a fast approximation, while safely protecting against division-by-zero.
- [`shz_sqrtf_fsrra`](https://sh4zam.com/api/scalar/shz_sqrtf_fsrra/): `float shz_sqrtf_fsrra(float x)` Returns the fast approximate square root of the given value, `x`.
- [`shz_sqrtf`](https://sh4zam.com/api/scalar/shz_sqrtf/): `float shz_sqrtf(float x)` Returns the fast approximate square root of the given value, `x`, safely returning `0.0f` is `x` == `0.0f`.
- [`shz_invf_fsrra`](https://sh4zam.com/api/scalar/shz_invf_fsrra/): `float shz_invf_fsrra(float x)` Takes the inverse of `x` using a very fast approximation, returning a positive result.
- [`shz_invf`](https://sh4zam.com/api/scalar/shz_invf/): `float shz_invf(float x)` Takes the inverse of `x` using a slighty faster approximation than doing a full division, safely handling negative values.
- [`shz_divf_fsrra`](https://sh4zam.com/api/scalar/shz_divf_fsrra/): `float shz_divf_fsrra(float num, float denom)` Divides `num` by `denom` using a very fast approximation, which requires `denom` be a positive value.
- [`shz_divf`](https://sh4zam.com/api/scalar/shz_divf/): `float shz_divf(float num, float denom)` Divides `num` by `denom` using a slightly faster approximation, allowing `denom` to be negative.

### Scalar: FIPR

- [`shz_dot6f`](https://sh4zam.com/api/scalar/shz_dot6f/): `float shz_dot6f(float x1, float y1, float z1, float x2, float y2, float z2)` Takes two sets of 3D vectors as 3 floats and calculates their dot product using an approximation.
- [`shz_dot8f`](https://sh4zam.com/api/scalar/shz_dot8f/): `float shz_dot8f(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2)` Takes two sets of 4D vectors as 4 floats and calculates their dot product using an approximation.
- [`shz_mag_sqr3f`](https://sh4zam.com/api/scalar/shz_mag_sqr3f/): `float shz_mag_sqr3f(float x, float y, float z)` Takes a 3D vector as 3 floats and calculates its squared magnitude using a fast approximation.
- [`shz_mag_sqr4f`](https://sh4zam.com/api/scalar/shz_mag_sqr4f/): `float shz_mag_sqr4f(float x, float y, float z, float w)` Takes a 4D vector as 4 floats and calculates its squared magnitude using a fast approximation.

### Scalar: Transcendental

- [`shz_pow2f`](https://sh4zam.com/api/scalar/shz_pow2f/): `float shz_pow2f(float p)` Fast approximation for raising 2 to a floating-point power.
- [`shz_powf`](https://sh4zam.com/api/scalar/shz_powf/): `float shz_powf(float x, float p)` Fast approximation for C's powf().
- [`shz_pow10f`](https://sh4zam.com/api/scalar/shz_pow10f/): `float shz_pow10f(float x)` Fast approximation of POSIX's pow10f().
- [`shz_log2f`](https://sh4zam.com/api/scalar/shz_log2f/): `float shz_log2f(float x)` Fast approximation for C's log2f().
- [`shz_logf`](https://sh4zam.com/api/scalar/shz_logf/): `float shz_logf(float x)` Fast approximation for C's logf().
- [`shz_log10f`](https://sh4zam.com/api/scalar/shz_log10f/): `float shz_log10f(float x)` Fast approximation for C's log10f().
- [`shz_expf`](https://sh4zam.com/api/scalar/shz_expf/): `float shz_expf(float p)` Fast approximation for C's expf().

### Scalar: Macros

- [`SHZ_FLT_EPSILON`](https://sh4zam.com/api/scalar/SHZ_FLT_EPSILON/): `#define SHZ_FLT_EPSILON 0.01f` Floating-point epsilon used with inexact FP-based comparisons.

## Trigonometry

`#include <sh4zam/shz_trig.h>` · [module page](https://sh4zam.com/api/trig/)

### Trigonometry: Sin/Cos Pairs

- [`shz_sincosu16`](https://sh4zam.com/api/trig/shz_sincosu16/): `shz_sincos_t shz_sincosu16(uint16_t radians16)` Returns sinf()/cosf() pairs for the given unsigned 16-bit angle in radians.
- [`shz_sincosf`](https://sh4zam.com/api/trig/shz_sincosf/): `shz_sincos_t shz_sincosf(float radians)` Returns sinf()/cosf() pairs for the given floating-point angle in radians.
- [`shz_sincosf_deg`](https://sh4zam.com/api/trig/shz_sincosf_deg/): `shz_sincos_t shz_sincosf_deg(float degrees)` Returns sinf/cosf() pairs for the given floating-point angle in degrees.
- [`shz_sincos_tanf`](https://sh4zam.com/api/trig/shz_sincos_tanf/): `float shz_sincos_tanf(shz_sincos_t sincos)` Returns tanf() from the given pre-computed `sincos` pair.
- [`shz_sincos_secf`](https://sh4zam.com/api/trig/shz_sincos_secf/): `float shz_sincos_secf(shz_sincos_t sincos)` Returns the floating-point secant (1.0f / cosf(x)) from the given pre-computed `sincos` pair.
- [`shz_sincos_cscf`](https://sh4zam.com/api/trig/shz_sincos_cscf/): `float shz_sincos_cscf(shz_sincos_t sincos)` Returns the floating-point cosecant (1.0f / sinf(x)) from the given pre-computed `sincos` pair.
- [`shz_sincos_cotf`](https://sh4zam.com/api/trig/shz_sincos_cotf/): `float shz_sincos_cotf(shz_sincos_t sincos)` Returns the floating-point cotangent (1.0f / tanf(x)) from the given pre-computed `sincos` pair.

### Trigonometry: Independent Functions

- [`shz_sinf`](https://sh4zam.com/api/trig/shz_sinf/): `float shz_sinf(float radians)` One-off routine for returning only sinf() from an angle in radians.
- [`shz_sinf_deg`](https://sh4zam.com/api/trig/shz_sinf_deg/): `float shz_sinf_deg(float degrees)` One-off routine for returning only sinf() from an angle in degrees.
- [`shz_cosf`](https://sh4zam.com/api/trig/shz_cosf/): `float shz_cosf(float radians)` One-off routine for returning only cosf() from an angle in radians.
- [`shz_cosf_deg`](https://sh4zam.com/api/trig/shz_cosf_deg/): `float shz_cosf_deg(float degrees)` One-off routine for returning only cosf() from an angle in degrees.
- [`shz_tanf`](https://sh4zam.com/api/trig/shz_tanf/): `float shz_tanf(float radians)` One-off routine for returning only tanf() from an angle in radians.
- [`shz_tanf_deg`](https://sh4zam.com/api/trig/shz_tanf_deg/): `float shz_tanf_deg(float degrees)` One-off routine for returning only tanf() from an angle in degrees.
- [`shz_secf`](https://sh4zam.com/api/trig/shz_secf/): `float shz_secf(float radians)` One-off routine for returning only secant (1 / cos(x)) from an angle in radians.
- [`shz_secf_deg`](https://sh4zam.com/api/trig/shz_secf_deg/): `float shz_secf_deg(float degrees)` One-off routine for returning only secant (1 / cos(x)) from an angle in degrees.
- [`shz_cscf`](https://sh4zam.com/api/trig/shz_cscf/): `float shz_cscf(float radians)` One-off routine for returning only cosecant (1 / sin(x)) from an angle in radians.
- [`shz_cscf_deg`](https://sh4zam.com/api/trig/shz_cscf_deg/): `float shz_cscf_deg(float degrees)` One-off routine for returning only cosecant (1 / sin(x)) from an angle in degrees.
- [`shz_cotf`](https://sh4zam.com/api/trig/shz_cotf/): `float shz_cotf(float radians)` One-off routine for returning only cotangent (1 / tan(x)) from an angle in radians.
- [`shz_cotf_deg`](https://sh4zam.com/api/trig/shz_cotf_deg/): `float shz_cotf_deg(float degrees)` One-off routine for returning only cotangent (1 / cot(x)) from an angle in degrees.

### Trigonometry: Inverse Functions

- [`shz_asinf`](https://sh4zam.com/api/trig/shz_asinf/): `float shz_asinf(float x)` Fast arcsine approximation; equivalent to C's asinf().
- [`shz_acosf`](https://sh4zam.com/api/trig/shz_acosf/): `float shz_acosf(float x)` Fast arccosine approximation; equivalent to C's acosf().
- [`shz_atanf_unit`](https://sh4zam.com/api/trig/shz_atanf_unit/): `float shz_atanf_unit(float x)` Fast arctangent approximation for unit values between `0.0f` and `1.0f`.
- [`shz_atanf_q1`](https://sh4zam.com/api/trig/shz_atanf_q1/): `float shz_atanf_q1(float x)` Fast arctangent approximation for values lying within the first quadrant (`>= 0.0f`).
- [`shz_atanf`](https://sh4zam.com/api/trig/shz_atanf/): `float shz_atanf(float x)` Fast arctangent approximation; equvalent to C's atanf().
- [`shz_atan2f`](https://sh4zam.com/api/trig/shz_atan2f/): `float shz_atan2f(float y, float x)` Computes arctangent of `y / x`, using the signs of arguments to determine correct quadtrant. Equivalent to C's atan2f().
- [`shz_asecf`](https://sh4zam.com/api/trig/shz_asecf/): `float shz_asecf(float x)` Fast arcsecant/inverse secant approximation, taking units in radians.
- [`shz_acscf`](https://sh4zam.com/api/trig/shz_acscf/): `float shz_acscf(float x)` Fast arccosecant/inverse cosecant approximation; taking units in radians.
- [`shz_acotf`](https://sh4zam.com/api/trig/shz_acotf/): `float shz_acotf(float x)` Fast arccotangent/inverse cotangent approximation; taking units in radians.

### Trigonometry: Hyperbolic Functions

- [`shz_sinhf`](https://sh4zam.com/api/trig/shz_sinhf/): `float shz_sinhf(float x)` Fast hyperbolic sine function.
- [`shz_coshf`](https://sh4zam.com/api/trig/shz_coshf/): `float shz_coshf(float x)` Fast hyperbolic cosine function.
- [`shz_tanhf`](https://sh4zam.com/api/trig/shz_tanhf/): `float shz_tanhf(float x)` Fast hyperbolic tangent function.
- [`shz_cschf`](https://sh4zam.com/api/trig/shz_cschf/): `float shz_cschf(float x)` Fast hyperbolic cosecant function.
- [`shz_sechf`](https://sh4zam.com/api/trig/shz_sechf/): `float shz_sechf(float x)` Fast hyperbolic secant function.
- [`shz_cothf`](https://sh4zam.com/api/trig/shz_cothf/): `float shz_cothf(float x)` Fast hyperbolic cotangent function.

### Trigonometry: Inverse Hyperbolic Functions

- [`shz_asinhf`](https://sh4zam.com/api/trig/shz_asinhf/): `float shz_asinhf(float x)` Fast hyperbolic arcsine function.
- [`shz_acoshf`](https://sh4zam.com/api/trig/shz_acoshf/): `float shz_acoshf(float x)` Fast hyperbolic arccosine function.
- [`shz_atanhf`](https://sh4zam.com/api/trig/shz_atanhf/): `float shz_atanhf(float x)` Fast hyperbolic arctangent function.
- [`shz_acschf`](https://sh4zam.com/api/trig/shz_acschf/): `float shz_acschf(float x)` Fast hyperbolic arccosecant function.
- [`shz_asechf`](https://sh4zam.com/api/trig/shz_asechf/): `float shz_asechf(float x)` Fast hyperbolic arcsecant function.
- [`shz_acothf`](https://sh4zam.com/api/trig/shz_acothf/): `float shz_acothf(float x)` Fast hyperbolic arccotangent function.

### Trigonometry: Macros

- [`SHZ_F_PI`](https://sh4zam.com/api/trig/SHZ_F_PI/): `#define SHZ_F_PI 3.14159265359f` Single-precision floating-point PI approximation (do not use M_PI!).
- [`SHZ_F_TAU`](https://sh4zam.com/api/trig/SHZ_F_TAU/): `#define SHZ_F_TAU (SHZ_F_PI * 2.0f)` Single-precision FP PI approximation times 2.
- [`SHZ_F_PI_2`](https://sh4zam.com/api/trig/SHZ_F_PI_2/): `#define SHZ_F_PI_2 (SHZ_F_PI * 0.5f)` Single-precision FP PI approximation divided by 2.
- [`SHZ_F_PI_4`](https://sh4zam.com/api/trig/SHZ_F_PI_4/): `#define SHZ_F_PI_4 (SHZ_F_PI * 0.25f)` Single-precision FP PI approximation divided by 4.
- [`SHZ_FSCA_RAD_FACTOR`](https://sh4zam.com/api/trig/SHZ_FSCA_RAD_FACTOR/): `#define SHZ_FSCA_RAD_FACTOR 10430.37835f` Multiplicative factor for passing the FSCA instruction angles in radians.
- [`SHZ_FSCA_DEG_FACTOR`](https://sh4zam.com/api/trig/SHZ_FSCA_DEG_FACTOR/): `#define SHZ_FSCA_DEG_FACTOR 182.04444443f` Multiplicative factor for passing the FSCA instrution angles in degrees.
- [`SHZ_FSCA_ERROR_MAX`](https://sh4zam.com/api/trig/SHZ_FSCA_ERROR_MAX/): `#define SHZ_FSCA_ERROR_MAX 4.76837158e-7` Maximum FP error for FSCA instruction.
- [`SHZ_DEG_TO_RAD`](https://sh4zam.com/api/trig/SHZ_DEG_TO_RAD/): `#define SHZ_DEG_TO_RAD(deg) ((deg) * SHZ_F_PI / 180.0f)` Converts the given angle in degrees to radians.
- [`SHZ_RAD_TO_DEG`](https://sh4zam.com/api/trig/SHZ_RAD_TO_DEG/): `#define SHZ_RAD_TO_DEG(rad) ((rad) * 180.0f / SHZ_F_PI)` Converts the given angle in radians to degrees.

### Trigonometry: Types

- [`shz_sincos_t`](https://sh4zam.com/api/trig/shz_sincos_t/): `struct shz_sincos_t` Pair representing the sine and cosine of a given angle.
- [`shz_sincos`](https://sh4zam.com/api/trig/shz_sincos/): `typedef shz_sincos_t shz_sincos` Alternate C `shz_sincos_t` typedef for those who hate POSIX style.

## Vector

`#include <sh4zam/shz_vector.h>` · [module page](https://sh4zam.com/api/vector/)

### Vector: Adapters

- [`shz_vec2_deref`](https://sh4zam.com/api/vector/shz_vec2_deref/): `#define shz_vec2_deref(ptr) (*((SHZ_ALIASING shz_vec2_t*)(ptr)))` Dereferences the given pointer to a sequence of 2 floats as a `shz_vec2_t`.
- [`shz_vec3_deref`](https://sh4zam.com/api/vector/shz_vec3_deref/): `#define shz_vec3_deref(ptr) (*((SHZ_ALIASING shz_vec3_t*)(ptr)))` Dereferences the given pointer to a sequence of 3 floats as a `shz_vec3_t`.
- [`shz_vec4_deref`](https://sh4zam.com/api/vector/shz_vec4_deref/): `#define shz_vec4_deref(ptr) (*((SHZ_ALIASING shz_vec4_t*)(ptr)))` Dereferences the given pointer to a sequence of 4 floats as a `shz_vec4_t`.
- [`shz_vec2_from`](https://sh4zam.com/api/vector/shz_vec2_from/): `#define shz_vec2_from(value) SHZ_CONVERT(shz_vec2_t, value)` Converts the given `value` or expression to the equivalent 2D SH4ZAM vector value.
- [`shz_vec3_from`](https://sh4zam.com/api/vector/shz_vec3_from/): `#define shz_vec3_from(value) SHZ_CONVERT(shz_vec3_t, value)` Converts the given `value` or expression to the equivalent 3D SH4ZAM vector value.
- [`shz_vec4_from`](https://sh4zam.com/api/vector/shz_vec4_from/): `#define shz_vec4_from(value) SHZ_CONVERT(shz_vec4_t, value)` Converts the given `value` or expression to the equivalent 4D SH4ZAM vector value.
- [`shz_vec2_to`](https://sh4zam.com/api/vector/shz_vec2_to/): `#define shz_vec2_to(type, vector) SHZ_CONVERT(type, vector)` Converts the given 2D `vector` into a value of the given `type`.
- [`shz_vec3_to`](https://sh4zam.com/api/vector/shz_vec3_to/): `#define shz_vec3_to(type, vector) SHZ_CONVERT(type, vector)` Converts the given 3D `vector` into a value of the given `type`.
- [`shz_vec4_to`](https://sh4zam.com/api/vector/shz_vec4_to/): `#define shz_vec4_to(type, vector) SHZ_CONVERT(type, vector)` Converts the given 4D `vector` into a value of the given `type`.

### Vector: Type-Generic Routines

- [`shz_vec_abs`](https://sh4zam.com/api/vector/shz_vec_abs/): `#define shz_vec_abs(vec)` C type-generic vector absolute value.
- [`shz_vec_neg`](https://sh4zam.com/api/vector/shz_vec_neg/): `#define shz_vec_neg(vec)` C type-generic vector negation.
- [`shz_vec_inv`](https://sh4zam.com/api/vector/shz_vec_inv/): `#define shz_vec_inv(vec)` C type-generic vector inversion.
- [`shz_vec_max`](https://sh4zam.com/api/vector/shz_vec_max/): `#define shz_vec_max(vec)` C type-generic vector maximum value.
- [`shz_vec_min`](https://sh4zam.com/api/vector/shz_vec_min/): `#define shz_vec_min(vec)` C type-generic vector minimum value.
- [`shz_vec_clamp`](https://sh4zam.com/api/vector/shz_vec_clamp/): `#define shz_vec_clamp(vec, min, max)` C type-generic vector minimum value.
- [`shz_vec_equal`](https://sh4zam.com/api/vector/shz_vec_equal/): `#define shz_vec_equal(vec1, vec2)` C type-generic vector equals.
- [`shz_vec_add`](https://sh4zam.com/api/vector/shz_vec_add/): `#define shz_vec_add(vec1, vec2)` C type-generic vector addition.
- [`shz_vec_sub`](https://sh4zam.com/api/vector/shz_vec_sub/): `#define shz_vec_sub(vec1, vec2)` C type-generic vector subtraction.
- [`shz_vec_mul`](https://sh4zam.com/api/vector/shz_vec_mul/): `#define shz_vec_mul(vec1, vec2)` C type-generic vector multiplication.
- [`shz_vec_div`](https://sh4zam.com/api/vector/shz_vec_div/): `#define shz_vec_div(vec1, vec2)` C type-generic vector division.
- [`shz_vec_scale`](https://sh4zam.com/api/vector/shz_vec_scale/): `#define shz_vec_scale(vec, factor)` C type-generic vector scaling.
- [`shz_vec_dot`](https://sh4zam.com/api/vector/shz_vec_dot/): `#define shz_vec_dot(vec1, vec2)` C type-generic vector dot product.
- [`shz_vec_dot2`](https://sh4zam.com/api/vector/shz_vec_dot2/): `#define shz_vec_dot2(l, r1, r2)` C type-generic vector chained double dot product.
- [`shz_vec_dot3`](https://sh4zam.com/api/vector/shz_vec_dot3/): `#define shz_vec_dot3(l, r1, r2, r3)` C type-generic vector chained triple dot product.
- [`shz_vec_magnitude_sqr`](https://sh4zam.com/api/vector/shz_vec_magnitude_sqr/): `#define shz_vec_magnitude_sqr(vec)` C type-generic vector squared magnitude.
- [`shz_vec_magnitude`](https://sh4zam.com/api/vector/shz_vec_magnitude/): `#define shz_vec_magnitude(vec)` C type-generic vector magnitude.
- [`shz_vec_magnitude_inv`](https://sh4zam.com/api/vector/shz_vec_magnitude_inv/): `#define shz_vec_magnitude_inv(vec)` C type-generic vector inverse magnitude.
- [`shz_vec_normalize`](https://sh4zam.com/api/vector/shz_vec_normalize/): `#define shz_vec_normalize(vec)` C type-generic vector normalization.
- [`shz_vec_normalize_safe`](https://sh4zam.com/api/vector/shz_vec_normalize_safe/): `#define shz_vec_normalize_safe(vec)` C type-generic safe vector normalization.
- [`shz_vec_distance`](https://sh4zam.com/api/vector/shz_vec_distance/): `#define shz_vec_distance(vec1, vec2)` C type-generic vector distance.
- [`shz_vec_move`](https://sh4zam.com/api/vector/shz_vec_move/): `#define shz_vec_move(vec, target, maxdist)` C type-generic vector move.
- [`shz_vec_distance_sqr`](https://sh4zam.com/api/vector/shz_vec_distance_sqr/): `#define shz_vec_distance_sqr(vec1, vec2)` C type-generic vector squared distance.
- [`shz_vec_lerp`](https://sh4zam.com/api/vector/shz_vec_lerp/): `#define shz_vec_lerp(vec1, vec2, t)` C type-generic linear interpolation between two vectors.
- [`shz_vec_reflect`](https://sh4zam.com/api/vector/shz_vec_reflect/): `#define shz_vec_reflect(incidence, normal)` C type-generic vector reflection.
- [`shz_vec_refract`](https://sh4zam.com/api/vector/shz_vec_refract/): `#define shz_vec_refract(incidence, normal, eta)` C type-generic vector refraction.
- [`shz_vec_cross`](https://sh4zam.com/api/vector/shz_vec_cross/): `#define shz_vec_cross(vec1, vec2)` C type-generic vector cross-product.
- [`shz_vec_project`](https://sh4zam.com/api/vector/shz_vec_project/): `#define shz_vec_project(vec1, vec2)` C type-generic vector projection.
- [`shz_vec_project_safe`](https://sh4zam.com/api/vector/shz_vec_project_safe/): `#define shz_vec_project_safe(vec1, vec2)` C type-generic safe vector projection.
- [`shz_vec_angles`](https://sh4zam.com/api/vector/shz_vec_angles/): `#define shz_vec_angles(vec)` C type-generic angle-from-vector extraction.
- [`shz_vec_angle_between`](https://sh4zam.com/api/vector/shz_vec_angle_between/): `#define shz_vec_angle_between(vec1, vec2)` C type-generic angle between two vectors.
- [`shz_vec_swizzle`](https://sh4zam.com/api/vector/shz_vec_swizzle/): `#define shz_vec_swizzle(vec, ...)` C type-generic vector swizzling.
- [`shz_vec_floor`](https://sh4zam.com/api/vector/shz_vec_floor/): `#define shz_vec_floor(vec)` C type-generic component-wise floor.
- [`shz_vec_ceil`](https://sh4zam.com/api/vector/shz_vec_ceil/): `#define shz_vec_ceil(vec)` C type-generic component-wise ceil.
- [`shz_vec_round`](https://sh4zam.com/api/vector/shz_vec_round/): `#define shz_vec_round(vec)` C type-generic component-wise round.
- [`shz_vec_fract`](https://sh4zam.com/api/vector/shz_vec_fract/): `#define shz_vec_fract(vec)` C type-generic component-wise fract.
- [`shz_vec_sign`](https://sh4zam.com/api/vector/shz_vec_sign/): `#define shz_vec_sign(vec)` C type-generic component-wise sign.
- [`shz_vec_saturate`](https://sh4zam.com/api/vector/shz_vec_saturate/): `#define shz_vec_saturate(vec)` C type-generic component-wise saturate.
- [`shz_vec_minv`](https://sh4zam.com/api/vector/shz_vec_minv/): `#define shz_vec_minv(a, b)` C type-generic pairwise minimum.
- [`shz_vec_maxv`](https://sh4zam.com/api/vector/shz_vec_maxv/): `#define shz_vec_maxv(a, b)` C type-generic pairwise maximum.
- [`shz_vec_inv_sqrtf`](https://sh4zam.com/api/vector/shz_vec_inv_sqrtf/): `#define shz_vec_inv_sqrtf(vec)` C type-generic inv_sqrtf.
- [`shz_vec_sqrtf`](https://sh4zam.com/api/vector/shz_vec_sqrtf/): `#define shz_vec_sqrtf(vec)` C type-generic sqrtf.
- [`shz_vec_stepv`](https://sh4zam.com/api/vector/shz_vec_stepv/): `#define shz_vec_stepv(vec, edge)` C type-generic component-wise step.
- [`shz_vec_step`](https://sh4zam.com/api/vector/shz_vec_step/): `#define shz_vec_step(vec, edge)` C type-generic step.
- [`shz_vec_smoothstepv`](https://sh4zam.com/api/vector/shz_vec_smoothstepv/): `#define shz_vec_smoothstepv(vec, edge0, edge1)` C type-generic component-wise smoothstep.
- [`shz_vec_smoothstep`](https://sh4zam.com/api/vector/shz_vec_smoothstep/): `#define shz_vec_smoothstep(vec, edge0, edge1)` C type-generic smoothstep.
- [`shz_vec_smoothstepv_safe`](https://sh4zam.com/api/vector/shz_vec_smoothstepv_safe/): `#define shz_vec_smoothstepv_safe(vec, edge0, edge1)` C type-generic component-wise smoothstep_safe.
- [`shz_vec_smoothstep_safe`](https://sh4zam.com/api/vector/shz_vec_smoothstep_safe/): `#define shz_vec_smoothstep_safe(vec, edge0, edge1)` C type-generic smoothstep_safe.

### Vector: Initializers

- [`shz_vec2_init`](https://sh4zam.com/api/vector/shz_vec2_init/): `shz_vec2_t shz_vec2_init(float x, float y)` Returns a 2D vector with the given `x`, and `y` coordinates.
- [`shz_vec3_init`](https://sh4zam.com/api/vector/shz_vec3_init/): `shz_vec3_t shz_vec3_init(float x, float y, float z)` Returns a 3D vector with the given `x`, `y`, and `z` coordinates.
- [`shz_vec4_init`](https://sh4zam.com/api/vector/shz_vec4_init/): `shz_vec4_t shz_vec4_init(float x, float y, float z, float w)` Returns a 4D vector with the given `x`, `y`, `z`, and `w` coordinates.
- [`shz_vec2_fill`](https://sh4zam.com/api/vector/shz_vec2_fill/): `shz_vec2_t shz_vec2_fill(float v)` Returns a 2D vector with the value of each component equal to `v`.
- [`shz_vec3_fill`](https://sh4zam.com/api/vector/shz_vec3_fill/): `shz_vec3_t shz_vec3_fill(float v)` Returns a 3D vector with the value of each compoonent equal to `v`.
- [`shz_vec4_fill`](https://sh4zam.com/api/vector/shz_vec4_fill/): `shz_vec4_t shz_vec4_fill(float v)` Returns a 4D vector with the value of each component equal to `v`.

### Vector: Component-wise Operations

- [`shz_vec2_abs`](https://sh4zam.com/api/vector/shz_vec2_abs/): `shz_vec2_t shz_vec2_abs(shz_vec2_t vec)` Returns a 2D vector whose components are the absolute values of the given vector's components.
- [`shz_vec3_abs`](https://sh4zam.com/api/vector/shz_vec3_abs/): `shz_vec3_t shz_vec3_abs(shz_vec3_t vec)` Returns a 3D vector whose components are the absolute values of the given vector's components.
- [`shz_vec4_abs`](https://sh4zam.com/api/vector/shz_vec4_abs/): `shz_vec4_t shz_vec4_abs(shz_vec4_t vec)` Returns a 4D vector whose components are the absolute values of the given vector's components.
- [`shz_vec2_neg`](https://sh4zam.com/api/vector/shz_vec2_neg/): `shz_vec2_t shz_vec2_neg(shz_vec2_t vec)` Returns a 2D vector whose components are the negative values of the given vector's components.
- [`shz_vec3_neg`](https://sh4zam.com/api/vector/shz_vec3_neg/): `shz_vec3_t shz_vec3_neg(shz_vec3_t vec)` Returns a 3D vector whose components are the negative values of the given vector's components.
- [`shz_vec4_neg`](https://sh4zam.com/api/vector/shz_vec4_neg/): `shz_vec4_t shz_vec4_neg(shz_vec4_t vec)` Returns a 4D vector whose components are the negative values of the given vector's components.
- [`shz_vec2_inv`](https://sh4zam.com/api/vector/shz_vec2_inv/): `shz_vec2_t shz_vec2_inv(shz_vec2_t vec)` Returns the 2D vector whose components have been inverted or reciprocated.
- [`shz_vec3_inv`](https://sh4zam.com/api/vector/shz_vec3_inv/): `shz_vec3_t shz_vec3_inv(shz_vec3_t vec)` Returns the 3D vector whose components have been inverted or reciprocated.
- [`shz_vec4_inv`](https://sh4zam.com/api/vector/shz_vec4_inv/): `shz_vec4_t shz_vec4_inv(shz_vec4_t vec)` Returns the 4D vector whose components have been inverted or reciprocated.
- [`shz_vec2_max`](https://sh4zam.com/api/vector/shz_vec2_max/): `float shz_vec2_max(shz_vec2_t vec)` Returns the maximum value of both of the given vector's components.
- [`shz_vec3_max`](https://sh4zam.com/api/vector/shz_vec3_max/): `float shz_vec3_max(shz_vec3_t vec)` Returns the maximum value of the given vector's 3 components.
- [`shz_vec4_max`](https://sh4zam.com/api/vector/shz_vec4_max/): `float shz_vec4_max(shz_vec4_t vec)` Returns the maximum value of the given vector's 4 componetns.
- [`shz_vec2_min`](https://sh4zam.com/api/vector/shz_vec2_min/): `float shz_vec2_min(shz_vec2_t vec)` Retuns the minimum value of both of the given vector's components.
- [`shz_vec3_min`](https://sh4zam.com/api/vector/shz_vec3_min/): `float shz_vec3_min(shz_vec3_t vec)` Returns the minimum value of the given vector's 3 components.
- [`shz_vec4_min`](https://sh4zam.com/api/vector/shz_vec4_min/): `float shz_vec4_min(shz_vec4_t vec)` Returns the minimum value of the given vector's 4 components.
- [`shz_vec2_clamp`](https://sh4zam.com/api/vector/shz_vec2_clamp/): `shz_vec2_t shz_vec2_clamp(shz_vec2_t vec, float min, float max)` Clamps the values of the given 2D `vec` between `min` and `max`, returning a new vector.
- [`shz_vec3_clamp`](https://sh4zam.com/api/vector/shz_vec3_clamp/): `shz_vec3_t shz_vec3_clamp(shz_vec3_t vec, float min, float max)` Clamps the values of the given 3D `vec` between `min` and `max`, returning a new vector.
- [`shz_vec4_clamp`](https://sh4zam.com/api/vector/shz_vec4_clamp/): `shz_vec4_t shz_vec4_clamp(shz_vec4_t vec, float min, float max)` Clamps the values of the given 4D `vec` between `min` and `max`, returning a new vector.
- [`shz_vec2_floor`](https://sh4zam.com/api/vector/shz_vec2_floor/): `shz_vec2_t shz_vec2_floor(shz_vec2_t vec)` Returns a 2D vector whose components are the floor of the given vector's components.
- [`shz_vec3_floor`](https://sh4zam.com/api/vector/shz_vec3_floor/): `shz_vec3_t shz_vec3_floor(shz_vec3_t vec)` Returns a 3D vector whose components are the floor of the given vector's components.
- [`shz_vec4_floor`](https://sh4zam.com/api/vector/shz_vec4_floor/): `shz_vec4_t shz_vec4_floor(shz_vec4_t vec)` Returns a 4D vector whose components are the floor of the given vector's components.
- [`shz_vec2_ceil`](https://sh4zam.com/api/vector/shz_vec2_ceil/): `shz_vec2_t shz_vec2_ceil(shz_vec2_t vec)` Returns a 2D vector whose components are the ceil of the given vector's components.
- [`shz_vec3_ceil`](https://sh4zam.com/api/vector/shz_vec3_ceil/): `shz_vec3_t shz_vec3_ceil(shz_vec3_t vec)` Returns a 3D vector whose components are the ceil of the given vector's components.
- [`shz_vec4_ceil`](https://sh4zam.com/api/vector/shz_vec4_ceil/): `shz_vec4_t shz_vec4_ceil(shz_vec4_t vec)` Returns a 4D vector whose components are the ceil of the given vector's components.
- [`shz_vec2_round`](https://sh4zam.com/api/vector/shz_vec2_round/): `shz_vec2_t shz_vec2_round(shz_vec2_t vec)` Returns a 2D vector whose components are the rounded values of the given vector's components.
- [`shz_vec3_round`](https://sh4zam.com/api/vector/shz_vec3_round/): `shz_vec3_t shz_vec3_round(shz_vec3_t vec)` Returns a 3D vector whose components are the rounded values of the given vector's components.
- [`shz_vec4_round`](https://sh4zam.com/api/vector/shz_vec4_round/): `shz_vec4_t shz_vec4_round(shz_vec4_t vec)` Returns a 4D vector whose components are the rounded values of the given vector's components.
- [`shz_vec2_fract`](https://sh4zam.com/api/vector/shz_vec2_fract/): `shz_vec2_t shz_vec2_fract(shz_vec2_t vec)` Returns a 2D vector whose components are the fractional parts of the given vector's components.
- [`shz_vec3_fract`](https://sh4zam.com/api/vector/shz_vec3_fract/): `shz_vec3_t shz_vec3_fract(shz_vec3_t vec)` Returns a 3D vector whose components are the fractional parts of the given vector's components.
- [`shz_vec4_fract`](https://sh4zam.com/api/vector/shz_vec4_fract/): `shz_vec4_t shz_vec4_fract(shz_vec4_t vec)` Returns a 4D vector whose components are the fractional parts of the given vector's components.
- [`shz_vec2_sign`](https://sh4zam.com/api/vector/shz_vec2_sign/): `shz_vec2_t shz_vec2_sign(shz_vec2_t vec)` Returns a 2D vector whose components are the signs (-1, 0, or 1) of the given vector's components.
- [`shz_vec3_sign`](https://sh4zam.com/api/vector/shz_vec3_sign/): `shz_vec3_t shz_vec3_sign(shz_vec3_t vec)` Returns a 3D vector whose components are the signs (-1, 0, or 1) of the given vector's components.
- [`shz_vec4_sign`](https://sh4zam.com/api/vector/shz_vec4_sign/): `shz_vec4_t shz_vec4_sign(shz_vec4_t vec)` Returns a 4D vector whose components are the signs (-1, 0, or 1) of the given vector's components.
- [`shz_vec2_saturate`](https://sh4zam.com/api/vector/shz_vec2_saturate/): `shz_vec2_t shz_vec2_saturate(shz_vec2_t vec)` Returns a 2D vector whose components are saturated (clamped to \[0, 1\]) values of the given vector's components.
- [`shz_vec3_saturate`](https://sh4zam.com/api/vector/shz_vec3_saturate/): `shz_vec3_t shz_vec3_saturate(shz_vec3_t vec)` Returns a 3D vector whose components are saturated (clamped to \[0, 1\]) values of the given vector's components.
- [`shz_vec4_saturate`](https://sh4zam.com/api/vector/shz_vec4_saturate/): `shz_vec4_t shz_vec4_saturate(shz_vec4_t vec)` Returns a 4D vector whose components are saturated (clamped to \[0, 1\]) values of the given vector's components.
- [`shz_vec2_minv`](https://sh4zam.com/api/vector/shz_vec2_minv/): `shz_vec2_t shz_vec2_minv(shz_vec2_t a, shz_vec2_t b)` Returns a 2D vector whose components are the pairwise minimums of the two given vectors' components.
- [`shz_vec3_minv`](https://sh4zam.com/api/vector/shz_vec3_minv/): `shz_vec3_t shz_vec3_minv(shz_vec3_t a, shz_vec3_t b)` Returns a 3D vector whose components are the pairwise minimums of the two given vectors' components.
- [`shz_vec4_minv`](https://sh4zam.com/api/vector/shz_vec4_minv/): `shz_vec4_t shz_vec4_minv(shz_vec4_t a, shz_vec4_t b)` Returns a 4D vector whose components are the pairwise minimums of the two given vectors' components.
- [`shz_vec2_maxv`](https://sh4zam.com/api/vector/shz_vec2_maxv/): `shz_vec2_t shz_vec2_maxv(shz_vec2_t a, shz_vec2_t b)` Returns a 2D vector whose components are the pairwise maximums of the two given vectors' components.
- [`shz_vec3_maxv`](https://sh4zam.com/api/vector/shz_vec3_maxv/): `shz_vec3_t shz_vec3_maxv(shz_vec3_t a, shz_vec3_t b)` Returns a 3D vector whose components are the pairwise maximums of the two given vectors' components.
- [`shz_vec4_maxv`](https://sh4zam.com/api/vector/shz_vec4_maxv/): `shz_vec4_t shz_vec4_maxv(shz_vec4_t a, shz_vec4_t b)` Returns a 4D vector whose components are the pairwise maximums of the two given vectors' components.
- [`shz_vec2_equal`](https://sh4zam.com/api/vector/shz_vec2_equal/): `bool shz_vec2_equal(shz_vec2_t a, shz_vec2_t b)` Returns true if the values of each element within the two 2D vectors are approximately equal based on relative or absolute tolerance.
- [`shz_vec3_equal`](https://sh4zam.com/api/vector/shz_vec3_equal/): `bool shz_vec3_equal(shz_vec3_t a, shz_vec3_t b)` Returns true if the values of each element within the two 3D vectors are approximately equal based on relative or absolute tolerance.
- [`shz_vec4_equal`](https://sh4zam.com/api/vector/shz_vec4_equal/): `bool shz_vec4_equal(shz_vec4_t a, shz_vec4_t b)` Returns true if the values of each element within the two 4D vectors are approximately equal based on relative or absolute tolerance.
- [`shz_vec2_stepv`](https://sh4zam.com/api/vector/shz_vec2_stepv/): `shz_vec2_t shz_vec2_stepv( shz_vec2_t vec, shz_vec2_t edge)` For each component: returns 0.0f if vec\[i\] \< edge\[i\], otherwise 1.0f.
- [`shz_vec3_stepv`](https://sh4zam.com/api/vector/shz_vec3_stepv/): `shz_vec3_t shz_vec3_stepv(shz_vec3_t vec, shz_vec3_t edge)` For each component: returns 0.0f if vec\[i\] \< edge\[i\], otherwise 1.0f.
- [`shz_vec4_stepv`](https://sh4zam.com/api/vector/shz_vec4_stepv/): `shz_vec4_t shz_vec4_stepv(shz_vec4_t vec, shz_vec4_t edge)` For each component: returns 0.0f if vec\[i\] \< edge\[i\], otherwise 1.0f.
- [`shz_vec2_step`](https://sh4zam.com/api/vector/shz_vec2_step/): `shz_vec2_t shz_vec2_step(shz_vec2_t vec, float edge)` For each component: returns 0.0f if vec\[i\] \< edge, otherwise 1.0f.
- [`shz_vec3_step`](https://sh4zam.com/api/vector/shz_vec3_step/): `shz_vec3_t shz_vec3_step(shz_vec3_t vec, float edge)` For each component: returns 0.0f if vec\[i\] \< edge, otherwise 1.0f.
- [`shz_vec4_step`](https://sh4zam.com/api/vector/shz_vec4_step/): `shz_vec4_t shz_vec4_step(shz_vec4_t vec, float edge)` For each component: returns 0.0f if vec\[i\] \< edge, otherwise 1.0f.
- [`shz_vec2_smoothstep`](https://sh4zam.com/api/vector/shz_vec2_smoothstep/): `shz_vec2_t shz_vec2_smoothstep(shz_vec2_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between.
- [`shz_vec3_smoothstep`](https://sh4zam.com/api/vector/shz_vec3_smoothstep/): `shz_vec3_t shz_vec3_smoothstep(shz_vec3_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between.
- [`shz_vec4_smoothstep`](https://sh4zam.com/api/vector/shz_vec4_smoothstep/): `shz_vec4_t shz_vec4_smoothstep(shz_vec4_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between.
- [`shz_vec2_smoothstepv`](https://sh4zam.com/api/vector/shz_vec2_smoothstepv/): `shz_vec2_t shz_vec2_smoothstepv(shz_vec2_t vec, shz_vec2_t edge0, shz_vec2_t edge1)` For each component: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between.
- [`shz_vec3_smoothstepv`](https://sh4zam.com/api/vector/shz_vec3_smoothstepv/): `shz_vec3_t shz_vec3_smoothstepv(shz_vec3_t vec, shz_vec3_t edge0, shz_vec3_t edge1)` For each component i: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between.
- [`shz_vec4_smoothstepv`](https://sh4zam.com/api/vector/shz_vec4_smoothstepv/): `shz_vec4_t shz_vec4_smoothstepv(shz_vec4_t vec, shz_vec4_t edge0, shz_vec4_t edge1)` For each component i: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between.
- [`shz_vec2_smoothstep_safe`](https://sh4zam.com/api/vector/shz_vec2_smoothstep_safe/): `shz_vec2_t shz_vec2_smoothstep_safe(shz_vec2_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. Accepts inverse edges.
- [`shz_vec3_smoothstep_safe`](https://sh4zam.com/api/vector/shz_vec3_smoothstep_safe/): `shz_vec3_t shz_vec3_smoothstep_safe(shz_vec3_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. Accepts inverse edges.
- [`shz_vec4_smoothstep_safe`](https://sh4zam.com/api/vector/shz_vec4_smoothstep_safe/): `shz_vec4_t shz_vec4_smoothstep_safe(shz_vec4_t vec, float edge0, float edge1)` For each component: returns 0.0f at/below edge0, 1.0f at/above edge1, smoothly varying in-between. Accepts inverse edges.
- [`shz_vec2_smoothstepv_safe`](https://sh4zam.com/api/vector/shz_vec2_smoothstepv_safe/): `shz_vec2_t shz_vec2_smoothstepv_safe(shz_vec2_t vec, shz_vec2_t edge0, shz_vec2_t edge1)` For each component: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between. Accepts inverse edges.
- [`shz_vec3_smoothstepv_safe`](https://sh4zam.com/api/vector/shz_vec3_smoothstepv_safe/): `shz_vec3_t shz_vec3_smoothstepv_safe(shz_vec3_t vec, shz_vec3_t edge0, shz_vec3_t edge1)` For each component i: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between. Accepts inverse edges.
- [`shz_vec4_smoothstepv_safe`](https://sh4zam.com/api/vector/shz_vec4_smoothstepv_safe/): `shz_vec4_t shz_vec4_smoothstepv_safe(shz_vec4_t vec, shz_vec4_t edge0, shz_vec4_t edge1)` For each component i: returns 0.0f at/below edge0\[i\], 1.0f at/above edge1\[i\], smoothly varying in-between. Accepts inverse edges.
- [`shz_vec2_inv_sqrtf`](https://sh4zam.com/api/vector/shz_vec2_inv_sqrtf/): `shz_vec2_t shz_vec2_inv_sqrtf(shz_vec2_t vec)` Returns a 2D vector whose components are the inverse square root of the given vector's components.
- [`shz_vec3_inv_sqrtf`](https://sh4zam.com/api/vector/shz_vec3_inv_sqrtf/): `shz_vec3_t shz_vec3_inv_sqrtf(shz_vec3_t vec)` Returns a 3D vector whose components are the inverse square root of the given vector's components.
- [`shz_vec4_inv_sqrtf`](https://sh4zam.com/api/vector/shz_vec4_inv_sqrtf/): `shz_vec4_t shz_vec4_inv_sqrtf(shz_vec4_t vec)` Returns a 4D vector whose components are the inverse square root of the given vector's components.
- [`shz_vec2_sqrtf`](https://sh4zam.com/api/vector/shz_vec2_sqrtf/): `shz_vec2_t shz_vec2_sqrtf(shz_vec2_t vec)` Returns a 2D vector whose components are the square root of the given vector's components.
- [`shz_vec3_sqrtf`](https://sh4zam.com/api/vector/shz_vec3_sqrtf/): `shz_vec3_t shz_vec3_sqrtf(shz_vec3_t vec)` Returns a 3D vector whose components are the square root of the given vector's components.
- [`shz_vec4_sqrtf`](https://sh4zam.com/api/vector/shz_vec4_sqrtf/): `shz_vec4_t shz_vec4_sqrtf(shz_vec4_t vec)` Returns a 4D vector whose components are the square root of the given vector's components.

### Vector: Arithmetic

- [`shz_vec2_add`](https://sh4zam.com/api/vector/shz_vec2_add/): `shz_vec2_t shz_vec2_add(shz_vec2_t vec1, shz_vec2_t vec2)` Returns a 2D vector whose components are the sums of the given vectors' components.
- [`shz_vec3_add`](https://sh4zam.com/api/vector/shz_vec3_add/): `shz_vec3_t shz_vec3_add(shz_vec3_t vec1, shz_vec3_t vec2)` Returns a 3D vector whose components are the sums of the given vectors' components.
- [`shz_vec4_add`](https://sh4zam.com/api/vector/shz_vec4_add/): `shz_vec4_t shz_vec4_add(shz_vec4_t vec1, shz_vec4_t vec2)` Returns a 4D vector whose components are the sums of the given vectors' components.
- [`shz_vec2_sub`](https://sh4zam.com/api/vector/shz_vec2_sub/): `shz_vec2_t shz_vec2_sub(shz_vec2_t vec1, shz_vec2_t vec2)` Returns a 2D vector whose components are equal to the values of `vec1` minus `vec2`.
- [`shz_vec3_sub`](https://sh4zam.com/api/vector/shz_vec3_sub/): `shz_vec3_t shz_vec3_sub(shz_vec3_t vec1, shz_vec3_t vec2)` Returns a 3D vector whose components are equal to the values of `vec1` minus `vec2`.
- [`shz_vec4_sub`](https://sh4zam.com/api/vector/shz_vec4_sub/): `shz_vec4_t shz_vec4_sub(shz_vec4_t vec1, shz_vec4_t vec2)` Returns a 4D vector whose components are equal to the values of `vec1` minus `vec2`.
- [`shz_vec2_mul`](https://sh4zam.com/api/vector/shz_vec2_mul/): `shz_vec2_t shz_vec2_mul(shz_vec2_t vec1, shz_vec2_t vec2)` Returns a 2D vector whose component values are those of `vec1` times `vec2`.
- [`shz_vec3_mul`](https://sh4zam.com/api/vector/shz_vec3_mul/): `shz_vec3_t shz_vec3_mul(shz_vec3_t vec1, shz_vec3_t vec2)` Returns a 3D vector whose component values are those of `vec1` times `vec2`.
- [`shz_vec4_mul`](https://sh4zam.com/api/vector/shz_vec4_mul/): `shz_vec4_t shz_vec4_mul(shz_vec4_t vec1, shz_vec4_t vec2)` Returns a 4D vector whose component values are those of `vec1` times `vec2`.
- [`shz_vec2_div`](https://sh4zam.com/api/vector/shz_vec2_div/): `shz_vec2_t shz_vec2_div(shz_vec2_t vec1, shz_vec2_t vec2)` Returns a 2D vector whose component values are those of `vec1` divided by `vec2`.
- [`shz_vec3_div`](https://sh4zam.com/api/vector/shz_vec3_div/): `shz_vec3_t shz_vec3_div(shz_vec3_t vec1, shz_vec3_t vec2)` Returns a 3D vector whose component values are those of `vec1` divided by `vec2`.
- [`shz_vec4_div`](https://sh4zam.com/api/vector/shz_vec4_div/): `shz_vec4_t shz_vec4_div(shz_vec4_t vec1, shz_vec4_t vec2)` Returns a 4D vector whose component values are those of `vec1` divided by `vec2`.
- [`shz_vec2_scale`](https://sh4zam.com/api/vector/shz_vec2_scale/): `shz_vec2_t shz_vec2_scale(shz_vec2_t vec, float factor)` Returns a 2D vector whose component values are those of the given vector multiplied by a factor.
- [`shz_vec3_scale`](https://sh4zam.com/api/vector/shz_vec3_scale/): `shz_vec3_t shz_vec3_scale(shz_vec3_t vec, float factor)` Returns a 3D vector whose component values are those of the given vector multiplied by a factor.
- [`shz_vec4_scale`](https://sh4zam.com/api/vector/shz_vec4_scale/): `shz_vec4_t shz_vec4_scale(shz_vec4_t vec, float factor)` Returns a 4D vector whose component values are those of the given vector multiplied by a factor.

### Vector: Magnitude

- [`shz_vec2_magnitude_sqr`](https://sh4zam.com/api/vector/shz_vec2_magnitude_sqr/): `float shz_vec2_magnitude_sqr(shz_vec2_t vec)` Returns the squared magnitude of the given 2D vector.
- [`shz_vec4_magnitude_sqr`](https://sh4zam.com/api/vector/shz_vec4_magnitude_sqr/): `float shz_vec4_magnitude_sqr(shz_vec4_t vec)` Returns the squared magnitude of the given 4D vector.
- [`shz_vec3_magnitude_sqr`](https://sh4zam.com/api/vector/shz_vec3_magnitude_sqr/): `float shz_vec3_magnitude_sqr(shz_vec3_t vec)` Returns the squared magnitude of the given 3D vector.
- [`shz_vec2_magnitude`](https://sh4zam.com/api/vector/shz_vec2_magnitude/): `float shz_vec2_magnitude(shz_vec2_t vec)` Returns the magnitude of the given 2D vector.
- [`shz_vec3_magnitude`](https://sh4zam.com/api/vector/shz_vec3_magnitude/): `float shz_vec3_magnitude(shz_vec3_t vec)` Returns the magnitude of the given 3D vector.
- [`shz_vec4_magnitude`](https://sh4zam.com/api/vector/shz_vec4_magnitude/): `float shz_vec4_magnitude(shz_vec4_t vec)` Returns the magnitude of the given 4D vector.
- [`shz_vec2_magnitude_inv`](https://sh4zam.com/api/vector/shz_vec2_magnitude_inv/): `float shz_vec2_magnitude_inv(shz_vec2_t vec)` Returns the inverse magnitude of the given 2D vector.
- [`shz_vec3_magnitude_inv`](https://sh4zam.com/api/vector/shz_vec3_magnitude_inv/): `float shz_vec3_magnitude_inv(shz_vec3_t vec)` Returns the inverse magnitude of the given 3D vector.
- [`shz_vec4_magnitude_inv`](https://sh4zam.com/api/vector/shz_vec4_magnitude_inv/): `float shz_vec4_magnitude_inv(shz_vec4_t vec)` Returns the inverse magnitude of the given 4D vector.
- [`shz_vec2_normalize`](https://sh4zam.com/api/vector/shz_vec2_normalize/): `shz_vec2_t shz_vec2_normalize(shz_vec2_t vec)` Returns a normalized unit vector from the given 2D vector.
- [`shz_vec3_normalize`](https://sh4zam.com/api/vector/shz_vec3_normalize/): `shz_vec3_t shz_vec3_normalize(shz_vec3_t vec)` Returns a normalized unit vector from the given 3D vector.
- [`shz_vec4_normalize`](https://sh4zam.com/api/vector/shz_vec4_normalize/): `shz_vec4_t shz_vec4_normalize(shz_vec4_t vec)` Returns a normalized unit vector from the given 4D vector.
- [`shz_vec2_normalize_safe`](https://sh4zam.com/api/vector/shz_vec2_normalize_safe/): `shz_vec2_t shz_vec2_normalize_safe(shz_vec2_t vec)` SAFELY returns a normalized unit vector from the given 2D vector.
- [`shz_vec3_normalize_safe`](https://sh4zam.com/api/vector/shz_vec3_normalize_safe/): `shz_vec3_t shz_vec3_normalize_safe(shz_vec3_t vec)` SAFELY returns a normalized unit vector from the given 3D vector.
- [`shz_vec4_normalize_safe`](https://sh4zam.com/api/vector/shz_vec4_normalize_safe/): `shz_vec4_t shz_vec4_normalize_safe(shz_vec4_t vec)` SAFELY returns a normalized unit vector from the given 4D vector.

### Vector: Binary Operations

- [`shz_vec2_dot`](https://sh4zam.com/api/vector/shz_vec2_dot/): `float shz_vec2_dot(shz_vec2_t vec1, shz_vec2_t vec2)` Returns the dot product between the two given 2D vectors.
- [`shz_vec2_dot2`](https://sh4zam.com/api/vector/shz_vec2_dot2/): `shz_vec2_t shz_vec2_dot2(shz_vec2_t l, shz_vec2_t r1, shz_vec2_t r2)` Returns the two dot products taken between the 2D vector `l` and 2D vectors `r1` and `r2`.
- [`shz_vec2_dot3`](https://sh4zam.com/api/vector/shz_vec2_dot3/): `shz_vec3_t shz_vec2_dot3(shz_vec2_t l, shz_vec2_t r1, shz_vec2_t r2, shz_vec2_t r3)` Returns the three dot products taken between the 2D vector `l` and 2D vectors `r1`, `r2`, and `r3`.
- [`shz_vec3_dot`](https://sh4zam.com/api/vector/shz_vec3_dot/): `float shz_vec3_dot(shz_vec3_t vec1, shz_vec3_t vec2)` Returns the dot product between the two given 3D vectors.
- [`shz_vec3_dot2`](https://sh4zam.com/api/vector/shz_vec3_dot2/): `shz_vec2_t shz_vec3_dot2(shz_vec3_t l, shz_vec3_t r1, shz_vec3_t r2)` Returns the two dot products taken between the 3D vector `l` and 3D vectors `r1` and `r2`.
- [`shz_vec3_dot3`](https://sh4zam.com/api/vector/shz_vec3_dot3/): `shz_vec3_t shz_vec3_dot3(shz_vec3_t l, shz_vec3_t r1, shz_vec3_t r2, shz_vec3_t r3)` Returns the three dot products taken between the 3D vector `l` and 3D vectors `r1`, `r2`, and `r3`.
- [`shz_vec4_dot`](https://sh4zam.com/api/vector/shz_vec4_dot/): `float shz_vec4_dot(shz_vec4_t vec1, shz_vec4_t vec2)` Returns the dot product between the two given 4D vectors.
- [`shz_vec4_dot2`](https://sh4zam.com/api/vector/shz_vec4_dot2/): `shz_vec2_t shz_vec4_dot2(shz_vec4_t l, shz_vec4_t r1, shz_vec4_t r2)` Returns the two dot products taken between the 4D vector `l` and 4D vectors `r1` and `r2`.
- [`shz_vec4_dot3`](https://sh4zam.com/api/vector/shz_vec4_dot3/): `shz_vec3_t shz_vec4_dot3(shz_vec4_t l, shz_vec4_t r1, shz_vec4_t r2, shz_vec4_t r3)` Returns the three dot products taken between the 4D vector `l` and 4D vectors `r1`, `r2`, and `r3`.
- [`shz_vec2_distance`](https://sh4zam.com/api/vector/shz_vec2_distance/): `float shz_vec2_distance(shz_vec2_t vec1, shz_vec2_t vec2)` Returns the distance between the two given 2D vectors.
- [`shz_vec3_distance`](https://sh4zam.com/api/vector/shz_vec3_distance/): `float shz_vec3_distance(shz_vec3_t vec1, shz_vec3_t vec2)` Returns the distance between the two given 3D vectors.
- [`shz_vec4_distance`](https://sh4zam.com/api/vector/shz_vec4_distance/): `float shz_vec4_distance(shz_vec4_t vec1, shz_vec4_t vec2)` Returns the distance between the two given 4D vectors.
- [`shz_vec2_distance_sqr`](https://sh4zam.com/api/vector/shz_vec2_distance_sqr/): `float shz_vec2_distance_sqr(shz_vec2_t vec1, shz_vec2_t vec2)` Returns the squared-distance between the two given 2D vectors.
- [`shz_vec3_distance_sqr`](https://sh4zam.com/api/vector/shz_vec3_distance_sqr/): `float shz_vec3_distance_sqr(shz_vec3_t vec1, shz_vec3_t vec2)` Returns the squared-distance between the two given 3D vectors.
- [`shz_vec4_distance_sqr`](https://sh4zam.com/api/vector/shz_vec4_distance_sqr/): `float shz_vec4_distance_sqr(shz_vec4_t vec1, shz_vec4_t vec2)` Returns the squared-distance between the two given 4D vectors.
- [`shz_vec2_move`](https://sh4zam.com/api/vector/shz_vec2_move/): `shz_vec2_t shz_vec2_move(shz_vec2_t vec, shz_vec2_t target, float max_distance)` Returns the given 2D vector, translated towards the `target` by the given `max_distance`.
- [`shz_vec3_move`](https://sh4zam.com/api/vector/shz_vec3_move/): `shz_vec3_t shz_vec3_move(shz_vec3_t vec, shz_vec3_t target, float max_distance)` Returns the given 3D vector, translated towards the `target` by the given `max_distance`.
- [`shz_vec4_move`](https://sh4zam.com/api/vector/shz_vec4_move/): `shz_vec4_t shz_vec4_move(shz_vec4_t vec, shz_vec4_t target, float max_distance)` Returns the given 4D vector, translated towards the `target` by the given `max_distance`.
- [`shz_vec2_lerp`](https://sh4zam.com/api/vector/shz_vec2_lerp/): `shz_vec2_t shz_vec2_lerp(shz_vec2_t a, shz_vec2_t b, float t)` Returns a 2D vector that is linearly interpolated from `a` to `b` by the given `0.0f-1.0f` factor, `t`.
- [`shz_vec3_lerp`](https://sh4zam.com/api/vector/shz_vec3_lerp/): `shz_vec3_t shz_vec3_lerp(shz_vec3_t a, shz_vec3_t b, float t)` Returns a 3D vector that is linearly interpolated from `a` to `b` by the given `0.0f-1.0f` factor, `t`.
- [`shz_vec4_lerp`](https://sh4zam.com/api/vector/shz_vec4_lerp/): `shz_vec4_t shz_vec4_lerp(shz_vec4_t a, shz_vec4_t b, float t)` Returns a 4D vector that is linearly interpolated from `a` to `b` by the given `0.0f-1.0f` factor, `t`.
- [`shz_vec2_reflect`](https://sh4zam.com/api/vector/shz_vec2_reflect/): `shz_vec2_t shz_vec2_reflect(shz_vec2_t incidence, shz_vec2_t normal)` Reflects the given 2D `incidence` vector against a surface with the given `normal`, returning the result.
- [`shz_vec3_reflect`](https://sh4zam.com/api/vector/shz_vec3_reflect/): `shz_vec3_t shz_vec3_reflect(shz_vec3_t incidence, shz_vec3_t normal)` Reflects the given 3D `incidence` vector against a surface with the given `normal`, returning the result.
- [`shz_vec4_reflect`](https://sh4zam.com/api/vector/shz_vec4_reflect/): `shz_vec4_t shz_vec4_reflect(shz_vec4_t incidence, shz_vec4_t normal)` Reflects the given 4D `incidence` vector against a surface with the given `normal`, returning the result.
- [`shz_vec2_refract`](https://sh4zam.com/api/vector/shz_vec2_refract/): `shz_vec2_t shz_vec2_refract(shz_vec2_t incidence, shz_vec2_t normal, float eta)` Refracts the given 2D `incidence` vector against a surface with the given `normal` using the given refraction index ratio, `eta`.
- [`shz_vec3_refract`](https://sh4zam.com/api/vector/shz_vec3_refract/): `shz_vec3_t shz_vec3_refract(shz_vec3_t incidence, shz_vec3_t normal, float eta)` Refracts the given 3D `incidence` vector against a surface with the given `normal` using the given refraction index ratio, `eta`.
- [`shz_vec4_refract`](https://sh4zam.com/api/vector/shz_vec4_refract/): `shz_vec4_t shz_vec4_refract(shz_vec4_t incidence, shz_vec4_t normal, float eta)` Refracts the given 4D `incidence` vector against a surface with the given `normal` using the given refraction index ratio, `eta`.
- [`shz_vec2_cross`](https://sh4zam.com/api/vector/shz_vec2_cross/): `float shz_vec2_cross(shz_vec2_t vec1, shz_vec2_t vec2)` Returns the cross product, as a scalar, between two 2D vectors.
- [`shz_vec3_cross`](https://sh4zam.com/api/vector/shz_vec3_cross/): `shz_vec3_t shz_vec3_cross(shz_vec3_t vec1, shz_vec3_t vec2)` Returns the vector produced by taking the cross-product of the two given 3D vectors.
- [`shz_vec2_project`](https://sh4zam.com/api/vector/shz_vec2_project/): `shz_vec2_t shz_vec2_project(shz_vec2_t vec, shz_vec2_t onto)` Returns the resulting vector from projecting the given 2D vector along the given (unit) axis.
- [`shz_vec3_project`](https://sh4zam.com/api/vector/shz_vec3_project/): `shz_vec3_t shz_vec3_project(shz_vec3_t vec, shz_vec3_t onto)` Returns the resulting vector from projecting the given 3D vector along the given (unit) axis.
- [`shz_vec4_project`](https://sh4zam.com/api/vector/shz_vec4_project/): `shz_vec4_t shz_vec4_project(shz_vec4_t vec, shz_vec4_t onto)` Returns the resulting vector from projecting the given 4D vector along the given (unit) axis.
- [`shz_vec2_project_safe`](https://sh4zam.com/api/vector/shz_vec2_project_safe/): `shz_vec2_t shz_vec2_project_safe(shz_vec2_t vec, shz_vec2_t onto)` Returns the resulting vector from projecting the given 2D vector along the given (unit) axis.
- [`shz_vec3_project_safe`](https://sh4zam.com/api/vector/shz_vec3_project_safe/): `shz_vec3_t shz_vec3_project_safe(shz_vec3_t vec, shz_vec3_t onto)` Returns the resulting vector from projecting the given 3D vector along the given (unit) axis.
- [`shz_vec4_project_safe`](https://sh4zam.com/api/vector/shz_vec4_project_safe/): `shz_vec4_t shz_vec4_project_safe(shz_vec4_t vec, shz_vec4_t onto)` Returns the resulting vector from projecting the given 4D vector along the given (unit) axis.
- [`shz_vec3_reject`](https://sh4zam.com/api/vector/shz_vec3_reject/): `shz_vec3_t shz_vec3_reject(shz_vec3_t vec, shz_vec3_t onto)` Returns the rejection of the given vector, `vec`, onto another vector, `onto`.

### Vector: Miscellaneous

- [`shz_vec3_triple`](https://sh4zam.com/api/vector/shz_vec3_triple/): `float shz_vec3_triple(shz_vec3_t a, shz_vec3_t b, shz_vec3_t c)` Returns the 3D vector "triple product" between vector's `a`, `b`, and `c`.
- [`shz_vec3_perp`](https://sh4zam.com/api/vector/shz_vec3_perp/): `shz_vec3_t shz_vec3_perp(shz_vec3_t vec)` Returns a vector which is perpendicular to the given vector.
- [`shz_vec3_barycenter`](https://sh4zam.com/api/vector/shz_vec3_barycenter/): `shz_vec3_t shz_vec3_barycenter(shz_vec3_t p, shz_vec3_t a, shz_vec3_t b, shz_vec3_t c)` Computes barycentric coordinates `<u, v, w>` for point p, within the plane of the triangle with vertices `a`, `b`, and `c`.
- [`shz_vec3_orthonormalize`](https://sh4zam.com/api/vector/shz_vec3_orthonormalize/): `void shz_vec3_orthonormalize(shz_vec3_t in1, shz_vec3_t in2, shz_vec3_t* out1, shz_vec3_t* out2)` Returns 2 3D vectors which are normalized and orthogonal to the two input vectors.
- [`shz_vec3_cubic_hermite`](https://sh4zam.com/api/vector/shz_vec3_cubic_hermite/): `shz_vec3_t shz_vec3_cubic_hermite(shz_vec3_t vec, shz_vec3_t tangent1, shz_vec3_t vec2, shz_vec3_t tangent2, float amounht)` Calculates the cubic hermite interpolation between two vectors and their tangents.

### Vector: Angles

- [`shz_vec2_angle_between`](https://sh4zam.com/api/vector/shz_vec2_angle_between/): `float shz_vec2_angle_between(shz_vec2_t vec1, shz_vec2_t vec2)` Returns the angle formed between the given 2D vectors in radians.
- [`shz_vec3_angle_between`](https://sh4zam.com/api/vector/shz_vec3_angle_between/): `float shz_vec3_angle_between(shz_vec3_t vec1, shz_vec3_t vec2)` Returns the angle formed between the given 3D vectors in radians.
- [`shz_vec2_angle`](https://sh4zam.com/api/vector/shz_vec2_angle/): `float shz_vec2_angle(shz_vec2_t vec)` Returns the angle formed between the positive X axis and the given 2D vector, in radians.
- [`shz_vec3_angles`](https://sh4zam.com/api/vector/shz_vec3_angles/): `shz_vec3_t shz_vec3_angles(shz_vec3_t vec)` Returns the angles formed between the positive X axis and the given 3D vector, in radians.
- [`shz_vec2_from_sincos`](https://sh4zam.com/api/vector/shz_vec2_from_sincos/): `shz_vec2_t shz_vec2_from_sincos(shz_sincos_t sincos)` Returns the 2D unit vector representing a rotation from the positive X axis.
- [`shz_vec3_from_sincos`](https://sh4zam.com/api/vector/shz_vec3_from_sincos/): `shz_vec3_t shz_vec3_from_sincos(shz_sincos_t azimuth, shz_sincos_t elevation)` Returns the 3D unit vector representing the given rotation angles relative to the positive X axis.
- [`shz_vec2_from_angle`](https://sh4zam.com/api/vector/shz_vec2_from_angle/): `shz_vec2_t shz_vec2_from_angle(float radians)` Returns the 2D unit vector representing a rotation from the positive X axis in radians.
- [`shz_vec3_from_angles`](https://sh4zam.com/api/vector/shz_vec3_from_angles/): `shz_vec3_t shz_vec3_from_angles(float azimuth, float elevation)` Returns the 3D unit vector representing the given rotation angles relative to the positive X axis in radians.
- [`shz_vec2_from_angle_deg`](https://sh4zam.com/api/vector/shz_vec2_from_angle_deg/): `shz_vec2_t shz_vec2_from_angle_deg(float degrees)` Returns the 2D unit vector representing a rotation from the positive X axis in degrees.
- [`shz_vec3_from_angles_deg`](https://sh4zam.com/api/vector/shz_vec3_from_angles_deg/): `shz_vec3_t shz_vec3_from_angles_deg(float azimuth, float elevation)` Returns the 3D unit vector representing the given rotation angles relative to the positive X axis in degrees.
- [`shz_vec2_rotate`](https://sh4zam.com/api/vector/shz_vec2_rotate/): `shz_vec2_t shz_vec2_rotate(shz_vec2_t vec, float radians)` Rotates the given 2D vector about the Z axis by the given angle in radians.
- [`shz_vec3_rotate_x`](https://sh4zam.com/api/vector/shz_vec3_rotate_x/): `shz_vec3_t shz_vec3_rotate_x(shz_vec3_t vec, float radians)` Rotates the given 3D vector about the X axis by the given angle in radians.
- [`shz_vec3_rotate_y`](https://sh4zam.com/api/vector/shz_vec3_rotate_y/): `shz_vec3_t shz_vec3_rotate_y(shz_vec3_t vec, float radians)` Rotates the given 3D vector about the Y axis by the given angle in radians.
- [`shz_vec3_rotate_z`](https://sh4zam.com/api/vector/shz_vec3_rotate_z/): `shz_vec3_t shz_vec3_rotate_z(shz_vec3_t vec, float radians)` Rotates the given 3D vector about the Z axis by the given angle in radians.

### Vector: Extending

- [`shz_vec2_vec3`](https://sh4zam.com/api/vector/shz_vec2_vec3/): `shz_vec3_t shz_vec2_vec3(shz_vec2_t vec, float z)` Extends a 2D vector to 3D, using `z` as the value of the Z component.
- [`shz_vec2_vec4`](https://sh4zam.com/api/vector/shz_vec2_vec4/): `shz_vec4_t shz_vec2_vec4(shz_vec2_t vec, float z, float w)` Extends a 2D vector to 4D, using `z` and `w` as the values of the Z and W components.
- [`shz_vec3_vec4`](https://sh4zam.com/api/vector/shz_vec3_vec4/): `shz_vec4_t shz_vec3_vec4(shz_vec3_t vec, float w)` Extends a 3D vector to 4D, using `w` as the value of the W component.

### Vector: Swizzling

- [`shz_vec2_swizzle`](https://sh4zam.com/api/vector/shz_vec2_swizzle/): `shz_vec2_t shz_vec2_swizzle(shz_vec2_t vec, unsigned x_idx, unsigned y_idx)` Returns a 2D vector whose elements are equal to the source vector's values at the given indices.
- [`shz_vec3_swizzle`](https://sh4zam.com/api/vector/shz_vec3_swizzle/): `shz_vec3_t shz_vec3_swizzle(shz_vec3_t vec, unsigned x_idx, unsigned y_idx, unsigned z_idx)` Returns a 3D vector whose elements are equal to the source vector's values at the given indices.
- [`shz_vec4_swizzle`](https://sh4zam.com/api/vector/shz_vec4_swizzle/): `shz_vec4_t shz_vec4_swizzle(shz_vec4_t vec, unsigned x_idx, unsigned y_idx, unsigned z_idx, unsigned w_idx)` Returns a new 2D vector whose elements are equal to the source vector's values at the given indices.

### Vector: Types

- [`shz_vec2_t`](https://sh4zam.com/api/vector/shz_vec2_t/): `struct shz_vec2_t` 2D Vector type
- [`shz_vec2`](https://sh4zam.com/api/vector/shz_vec2/): `typedef shz_vec2_t shz_vec2` Alternate typedef for the `shz_vec2` struct for those who hate POSIX-style.
- [`shz_vec3_t`](https://sh4zam.com/api/vector/shz_vec3_t/): `struct shz_vec3_t` 3D Vector type
- [`shz_vec3`](https://sh4zam.com/api/vector/shz_vec3/): `typedef shz_vec3_t shz_vec3` Alternate typedef for the `shz_vec3` struct for those who hate POSIX-style.
- [`shz_vec4_t`](https://sh4zam.com/api/vector/shz_vec4_t/): `struct shz_vec4_t` 4D Vector type
- [`shz_vec4`](https://sh4zam.com/api/vector/shz_vec4/): `typedef shz_vec4_t shz_vec4` Alternate typedef for the `shz_vec4` struct for those who hate POSIX-style.

## Quaternion

`#include <sh4zam/shz_quat.h>` · [module page](https://sh4zam.com/api/quat/)

### Quaternion: Initialization

- [`shz_quat_init`](https://sh4zam.com/api/quat/shz_quat_init/): `shz_quat_t shz_quat_init(float w, float x, float y, float z)` Initializes and returns a new quaternion with the given components, in WXYZ order.
- [`shz_quat_identity`](https://sh4zam.com/api/quat/shz_quat_identity/): `shz_quat_t shz_quat_identity(void)` Initializes and returns an identity quaternion.
- [`shz_quat_equal`](https://sh4zam.com/api/quat/shz_quat_equal/): `bool shz_quat_equal(shz_quat_t a, shz_quat_t b)` Returns true if the two given quaternions are considered equal based on either absolute or relative tolerance.
- [`shz_quat_from_angles_xyz`](https://sh4zam.com/api/quat/shz_quat_from_angles_xyz/): `shz_quat_t shz_quat_from_angles_xyz(float xangle, float yangle, float zangle)` Initializes and returns a quaternion with the given X-Y-Z rotations in radians.
- [`shz_quat_from_rotation_xyz`](https://sh4zam.com/api/quat/shz_quat_from_rotation_xyz/): `shz_quat_t shz_quat_from_rotation_xyz(float xAngle, float yAngle, float zAngle)` Returns the quaternion of the rotation `shz_xmtrx_init_rotation_xyz()` builds, from angles in radians.
- [`shz_quat_from_rotation_zyx`](https://sh4zam.com/api/quat/shz_quat_from_rotation_zyx/): `shz_quat_t shz_quat_from_rotation_zyx(float zAngle, float yAngle, float xAngle)` Returns the quaternion of the rotation `shz_xmtrx_init_rotation_zyx()` builds, Qz \* Qy \* Qx, from angles in radians.
- [`shz_quat_from_rotation_zxy`](https://sh4zam.com/api/quat/shz_quat_from_rotation_zxy/): `shz_quat_t shz_quat_from_rotation_zxy(float zAngle, float xAngle, float yAngle)` Returns the quaternion of the rotation `shz_xmtrx_init_rotation_zxy()` builds, Qz \* Qx \* Qy, from angles in radians.
- [`shz_quat_from_rotation_yxz`](https://sh4zam.com/api/quat/shz_quat_from_rotation_yxz/): `shz_quat_t shz_quat_from_rotation_yxz(float yAngle, float xAngle, float zAngle)` Returns the quaternion of the rotation `shz_xmtrx_init_rotation_yxz()` builds, Qy \* Qx \* Qz, from angles in radians.
- [`shz_quat_from_rotation_xyz_u16`](https://sh4zam.com/api/quat/shz_quat_from_rotation_xyz_u16/): `shz_quat_t shz_quat_from_rotation_xyz_u16(uint16_t xAngle, uint16_t yAngle, uint16_t zAngle)` Equivalent to `shz_quat_from_rotation_xyz()`, with 16-bit binary angles (65536 per turn, the FSCA unit).
- [`shz_quat_from_rotation_zyx_u16`](https://sh4zam.com/api/quat/shz_quat_from_rotation_zyx_u16/): `shz_quat_t shz_quat_from_rotation_zyx_u16(uint16_t zAngle, uint16_t yAngle, uint16_t xAngle)` Equivalent to `shz_quat_from_rotation_zyx()`, with 16-bit binary angles.
- [`shz_quat_from_rotation_zxy_u16`](https://sh4zam.com/api/quat/shz_quat_from_rotation_zxy_u16/): `shz_quat_t shz_quat_from_rotation_zxy_u16(uint16_t zAngle, uint16_t xAngle, uint16_t yAngle)` Equivalent to `shz_quat_from_rotation_zxy()`, with 16-bit binary angles.
- [`shz_quat_from_rotation_yxz_u16`](https://sh4zam.com/api/quat/shz_quat_from_rotation_yxz_u16/): `shz_quat_t shz_quat_from_rotation_yxz_u16(uint16_t yAngle, uint16_t xAngle, uint16_t zAngle)` Equivalent to `shz_quat_from_rotation_yxz()`, with 16-bit binary angles.
- [`shz_quat_from_axis_angle`](https://sh4zam.com/api/quat/shz_quat_from_axis_angle/): `shz_quat_t shz_quat_from_axis_angle(shz_vec3_t axis, float angle)` Initializes and returns a quaternion representing a rotation of `angle` radians about the given `axis`.
- [`shz_quat_from_look_axis`](https://sh4zam.com/api/quat/shz_quat_from_look_axis/): `shz_quat_t shz_quat_from_look_axis(shz_vec3_t forward, shz_vec3_t up)` Creates a quaternion looking in the given direction with the given reference direction.
- [`shz_quat_from_rotated_axis`](https://sh4zam.com/api/quat/shz_quat_from_rotated_axis/): `shz_quat_t shz_quat_from_rotated_axis(shz_vec3_t v1, shz_vec3_t v2)` Returns the quaternion representing the rotation from axis `v1` to `v2`.
- [`shz_quat_lerp`](https://sh4zam.com/api/quat/shz_quat_lerp/): `shz_quat_t shz_quat_lerp(shz_quat_t a, shz_quat_t b, float t)` Returns the quaternion that is linearly interpolating `a` to `b`, by a t factor of `0.0f-1.0f`.
- [`shz_quat_nlerp`](https://sh4zam.com/api/quat/shz_quat_nlerp/): `shz_quat_t shz_quat_nlerp(shz_quat_t a, shz_quat_t b, float t)` Equivalent to `shz_quat_lerp()`, except that the resulting quaternion is normalized.
- [`shz_quat_slerp`](https://sh4zam.com/api/quat/shz_quat_slerp/): `shz_quat_t shz_quat_slerp(shz_quat_t q, shz_quat_t p, float t)` Returns the quaternion that is spherically linearly interpolating `a` to `b`, by a `t` factor of `0.0f-1.0f`.
- [`shz_quat_squad`](https://sh4zam.com/api/quat/shz_quat_squad/): `shz_quat_t shz_quat_squad(shz_quat_t q1, shz_quat_t q2, shz_quat_t s1, shz_quat_t s2, float t)` Evaluates a smooth cubic spherical interpolation (SQUAD) at parameter `t`.

### Quaternion: Properties

- [`shz_quat_angle`](https://sh4zam.com/api/quat/shz_quat_angle/): `float shz_quat_angle(shz_quat_t q)` Returns the angle of rotation from the given quaternion.
- [`shz_quat_axis`](https://sh4zam.com/api/quat/shz_quat_axis/): `shz_vec3_t shz_quat_axis(shz_quat_t q)` Returns the axis of rotation from the given quaternion.
- [`shz_quat_angle_x`](https://sh4zam.com/api/quat/shz_quat_angle_x/): `float shz_quat_angle_x(shz_quat_t q)` Returns the angle of rotation the quaternion represents about the X axis in radians.
- [`shz_quat_angle_y`](https://sh4zam.com/api/quat/shz_quat_angle_y/): `float shz_quat_angle_y(shz_quat_t q)` Returns the angle of rotation the quaternion represents about the Y axis in radians.
- [`shz_quat_angle_z`](https://sh4zam.com/api/quat/shz_quat_angle_z/): `float shz_quat_angle_z(shz_quat_t q)` Returns the angle of rotation the quaternion represents about the Z axis in radians.
- [`shz_quat_to_axis_angle`](https://sh4zam.com/api/quat/shz_quat_to_axis_angle/): `void shz_quat_to_axis_angle(shz_quat_t q, shz_vec3_t* vec, float* angle)` Returns both the axis and angle of rotation simultaneously (faster if both are needed) from the given quaternion.
- [`shz_quat_to_angles_xyz`](https://sh4zam.com/api/quat/shz_quat_to_angles_xyz/): `shz_vec3_t shz_quat_to_angles_xyz(shz_quat_t q)` Returns the roll, pitch, and yaw angles of rotation represented by the given quaternion.
- [`shz_quat_magnitude_sqr`](https://sh4zam.com/api/quat/shz_quat_magnitude_sqr/): `float shz_quat_magnitude_sqr(shz_quat_t quat)` Returns the squared magnitude of the given quaternion.
- [`shz_quat_magnitude`](https://sh4zam.com/api/quat/shz_quat_magnitude/): `float shz_quat_magnitude(shz_quat_t quat)` Returns the magnitude of the given quaternion.
- [`shz_quat_magnitude_inv`](https://sh4zam.com/api/quat/shz_quat_magnitude_inv/): `float shz_quat_magnitude_inv(shz_quat_t quat)` Returns the inverse magnitude of the given quaternion.

### Quaternion: Modifiers

- [`shz_quat_normalize`](https://sh4zam.com/api/quat/shz_quat_normalize/): `shz_quat_t shz_quat_normalize(shz_quat_t quat)` Returns the normalized form of the given quaternion.
- [`shz_quat_normalize_safe`](https://sh4zam.com/api/quat/shz_quat_normalize_safe/): `shz_quat_t shz_quat_normalize_safe(shz_quat_t quat)` SAFELY returns the normalized form of the given quaternion.
- [`shz_quat_conjugate`](https://sh4zam.com/api/quat/shz_quat_conjugate/): `shz_quat_t shz_quat_conjugate(shz_quat_t quat)` Returns the conjugate of the given quaternion.
- [`shz_quat_inv`](https://sh4zam.com/api/quat/shz_quat_inv/): `shz_quat_t shz_quat_inv(shz_quat_t quat)` Returns the inverse of the given quaternion.
- [`shz_quat_neg`](https://sh4zam.com/api/quat/shz_quat_neg/): `shz_quat_t shz_quat_neg(shz_quat_t quat)` Returns the negation of the given quaternion.

### Quaternion: Arithmetic

- [`shz_quat_add`](https://sh4zam.com/api/quat/shz_quat_add/): `shz_quat_t shz_quat_add(shz_quat_t q, shz_quat_t p)` Returns the quaternion produced from adding each component of the given quaternions.
- [`shz_quat_sub`](https://sh4zam.com/api/quat/shz_quat_sub/): `shz_quat_t shz_quat_sub(shz_quat_t q, shz_quat_t p)` Returns the quaternion produced from subtracting each component of quaternion `p` from quaterion `q`.
- [`shz_quat_scale`](https://sh4zam.com/api/quat/shz_quat_scale/): `shz_quat_t shz_quat_scale(shz_quat_t q, float f)` Scales the components of the given quaternion by the given factor.
- [`shz_quat_mult`](https://sh4zam.com/api/quat/shz_quat_mult/): `shz_quat_t shz_quat_mult(shz_quat_t q1, shz_quat_t q2)` Multiplies the two quaternions, returning the result as a new quaternion.
- [`shz_quat_div`](https://sh4zam.com/api/quat/shz_quat_div/): `shz_quat_t shz_quat_div(shz_quat_t q, shz_quat_t p)` Divides quaternion `p` by quaternion `q` (multiplying by its inverse), returning the resulting quaternion.
- [`shz_quat_dot`](https://sh4zam.com/api/quat/shz_quat_dot/): `float shz_quat_dot(shz_quat_t q1, shz_quat_t q2)` Returns the dot product of the two quaternions.
- [`shz_quat_dot2`](https://sh4zam.com/api/quat/shz_quat_dot2/): `shz_vec2_t shz_quat_dot2(shz_quat_t l, shz_quat_t r1, shz_quat_t r2)` Returns the two dot products taken between the `l` quaternion and the `r1` and `r2` quaternions.
- [`shz_quat_dot3`](https://sh4zam.com/api/quat/shz_quat_dot3/): `shz_vec3_t shz_quat_dot3(shz_quat_t l, shz_quat_t r1, shz_quat_t r2, shz_quat_t r3)` Returns the two dot products taken between the `l` quaternion and the `r1`, `r2`, and `r3` quaternions.

### Quaternion: Miscellaneous

- [`shz_quat_angle_between`](https://sh4zam.com/api/quat/shz_quat_angle_between/): `float shz_quat_angle_between(shz_quat_t q, shz_quat_t p)` Returns the angle in radians between the rotations represented by quaternions `q` and `p`.
- [`shz_quat_rotate_towards`](https://sh4zam.com/api/quat/shz_quat_rotate_towards/): `shz_quat_t shz_quat_rotate_towards(shz_quat_t from, shz_quat_t to, float max_angle)` Rotates quaternion `from` towards quaternion `to` by at most `max_angle` radians.

### Quaternion: Transformations

- [`shz_quat_transform_vec3`](https://sh4zam.com/api/quat/shz_quat_transform_vec3/): `shz_vec3_t shz_quat_transform_vec3(shz_quat_t q, shz_vec3_t v)` Rotates a vector by the given quaternion.

### Quaternion: Types

- [`shz_quat_t`](https://sh4zam.com/api/quat/shz_quat_t/): `struct shz_quat_t` Represents a 3D quaternion.
- [`shz_quat`](https://sh4zam.com/api/quat/shz_quat/): `typedef shz_quat_t shz_quat` Alternate `shz_quat_t` C typedef for those who hate POSIX style.

## Matrix

`#include <sh4zam/shz_matrix.h>` · [module page](https://sh4zam.com/api/matrix/)

### Matrix: Initialization

- [`shz_mat4x4_init_identity`](https://sh4zam.com/api/matrix/shz_mat4x4_init_identity/): `void shz_mat4x4_init_identity(shz_mat4x4_t* mat)` Initializes the given matrix to the 4x4 identity matrix.
- [`shz_mat4x4_init_identity_safe`](https://sh4zam.com/api/matrix/shz_mat4x4_init_identity_safe/): `void shz_mat4x4_init_identity_safe(shz_mat4x4_t* mat)` Safely initializes the given matrix to the 4x4 identity matrix.
- [`shz_mat4x4_init_zero`](https://sh4zam.com/api/matrix/shz_mat4x4_init_zero/): `void shz_mat4x4_init_zero(shz_mat4x4_t* mat)` Initializes the given matrix with all 0s for its element values.
- [`shz_mat4x4_init_one`](https://sh4zam.com/api/matrix/shz_mat4x4_init_one/): `void shz_mat4x4_init_one(shz_mat4x4_t* mat)` Initializes the given matrix with all 1s for its element values.
- [`shz_mat4x4_init_fill`](https://sh4zam.com/api/matrix/shz_mat4x4_init_fill/): `void shz_mat4x4_init_fill(shz_mat4x4_t* mat, float value)` Initializes the given matrix with all elements assigned to the given value.
- [`shz_mat4x4_init_translation`](https://sh4zam.com/api/matrix/shz_mat4x4_init_translation/): `void shz_mat4x4_init_translation(shz_mat4x4_t* mat, float x, float y, float z)` Initializes the given matrix to a 3D translation matrix with the given coordinates.
- [`shz_mat4x4_init_scale`](https://sh4zam.com/api/matrix/shz_mat4x4_init_scale/): `void shz_mat4x4_init_scale(shz_mat4x4_t* mat, float x, float y, float z)` Initializes the given matrix to a 3D scaling matrix with the given dimensions.
- [`shz_mat4x4_init_rotation_x`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_x/): `void shz_mat4x4_init_rotation_x(shz_mat4x4_t* mat, float xAngle)` Initializes the given matrix to a 3D rotation matrix by `xAngle` radians over the X-axis.
- [`shz_mat4x4_init_rotation_y`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_y/): `void shz_mat4x4_init_rotation_y(shz_mat4x4_t* mat, float yAngle)` Initializes the given matrix to a 3D rotation matrix by `yAngle` radians over the Y-axis.
- [`shz_mat4x4_init_rotation_z`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_z/): `void shz_mat4x4_init_rotation_z(shz_mat4x4_t* mat, float zAngle)` Initializes the given matrix to a 3D rotation matrix by `zAngle` radians over the Z-axis.
- [`shz_mat4x4_init_rotation_xyz`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_xyz/): `void shz_mat4x4_init_rotation_xyz(shz_mat4x4_t* mat, float xAngle, float yAngle, float zAngle)` Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given Tait-Bryan X-Y-Z angles.
- [`shz_mat4x4_init_rotation_zyx`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_zyx/): `void shz_mat4x4_init_rotation_zyx(shz_mat4x4_t* mat, float zAngle, float yAngle, float xAngle)` Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given Tait-Bryan Z-Y-X angles.
- [`shz_mat4x4_init_rotation_zxy`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_zxy/): `void shz_mat4x4_init_rotation_zxy(shz_mat4x4_t* mat, float zAngle, float xAngle, float yAngle)` Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given Tait-Bryan Z-X-Y angles.
- [`shz_mat4x4_init_rotation_yxz`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_yxz/): `void shz_mat4x4_init_rotation_yxz(shz_mat4x4_t* mat, float yAngle, float xAngle, float zAngle)` Initializes the given matrix to a 3D rotation matrix from the intrinsic rotation created by the given Tait-Bryan Y-X-Z angles.
- [`shz_mat4x4_init_rotation`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation/): `void shz_mat4x4_init_rotation(shz_mat4x4_t* mat, float radians, float xAxis, float yAxis, float zAxis)` Initializes the given 4x4 matrix to a 3D rotation matrix of `angle` radians about the vector with the given components.
- [`shz_mat4x4_init_rotation_dir`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_dir/): `void shz_mat4x4_init_rotation_dir(shz_mat4x4_t* mat, float angle, float x, float y, float z)` Initializes the given 4x4 matrix to contain a 3D rotation matrix of `angle` radians about the given direction.
- [`shz_mat4x4_init_rotation_quat`](https://sh4zam.com/api/matrix/shz_mat4x4_init_rotation_quat/): `void shz_mat4x4_init_rotation_quat(shz_mat4x4_t* m, shz_quat_t q)` Initializes the given matrix to a 3D rotation matrix with its orientation given by a quaternion.
- [`shz_mat4x4_init_diagonal`](https://sh4zam.com/api/matrix/shz_mat4x4_init_diagonal/): `void shz_mat4x4_init_diagonal(shz_mat4x4_t* mat, float x, float y, float z, float w)` Initializes the given matrix to a diagonal matrix with the given 4 values.
- [`shz_mat4x4_init_upper_triangular`](https://sh4zam.com/api/matrix/shz_mat4x4_init_upper_triangular/): `void shz_mat4x4_init_upper_triangular(shz_mat4x4_t* mat, float col1, shz_vec2_t col2, shz_vec3_t col3, shz_vec4_t col4)` Initializes the given matrix to an upper triangular matrix whose nonzero entries have the given value.
- [`shz_mat4x4_init_lower_triangular`](https://sh4zam.com/api/matrix/shz_mat4x4_init_lower_triangular/): `void shz_mat4x4_init_lower_triangular(shz_mat4x4_t* mat, shz_vec4_t col1, shz_vec3_t col2, shz_vec2_t col3, float col4)` Initializes the given matrix to a lower triangular matrix whose nonzero entries have the given value.
- [`shz_mat4x4_init_symmetric_skew`](https://sh4zam.com/api/matrix/shz_mat4x4_init_symmetric_skew/): `void shz_mat4x4_init_symmetric_skew(shz_mat4x4_t* mat, float x, float y, float z)` Initializes the given matrix to be the symmetric skew of the given 3D vector components.
- [`shz_mat4x4_init_outer_product`](https://sh4zam.com/api/matrix/shz_mat4x4_init_outer_product/): `void shz_mat4x4_init_outer_product(shz_mat4x4_t* mat, shz_vec4_t v1, shz_vec4_t v2)` Initializes the given matrix to be the result from taking the outer product of the two given 4D vectors.
- [`shz_mat4x4_init_permutation_wxyz`](https://sh4zam.com/api/matrix/shz_mat4x4_init_permutation_wxyz/): `void shz_mat4x4_init_permutation_wxyz(shz_mat4x4_t* mat)` Initializes the matrix to to a permutation matrix, which reorders the components of transformed vectors to be in WXYZ order.
- [`shz_mat4x4_init_permutation_yzwx`](https://sh4zam.com/api/matrix/shz_mat4x4_init_permutation_yzwx/): `void shz_mat4x4_init_permutation_yzwx(shz_mat4x4_t* mat)` Initializes the matrix to to a permutation matrix, which reorders the components of transformed vectors to be in YZWX order.
- [`shz_mat4x4_init_screen`](https://sh4zam.com/api/matrix/shz_mat4x4_init_screen/): `void shz_mat4x4_init_screen(shz_mat4x4_t* mat, float width, float height)` Initializes the given matrix to the viewport matrix with the given dimenions.
- [`shz_mat4x4_init_lookat`](https://sh4zam.com/api/matrix/shz_mat4x4_init_lookat/): `void shz_mat4x4_init_lookat(shz_mat4x4_t* mat, shz_vec3_t eye, shz_vec3_t center, shz_vec3_t up)` Initializes the given matrix to a "lookAt" view matrix.
- [`shz_mat4x4_init_ortho`](https://sh4zam.com/api/matrix/shz_mat4x4_init_ortho/): `void shz_mat4x4_init_ortho(shz_mat4x4_t* mat, float left, float right, float bottom, float top, float znear, float zfar)` Initializes the given matrix to an orthographic projection matrix.
- [`shz_mat4x4_init_frustum`](https://sh4zam.com/api/matrix/shz_mat4x4_init_frustum/): `void shz_mat4x4_init_frustum(shz_mat4x4_t* mat, float left, float right, float bottom, float top, float znear, float zfar)` Initializes the given matrix to a frustum projection matrix.
- [`shz_mat4x4_init_perspective`](https://sh4zam.com/api/matrix/shz_mat4x4_init_perspective/): `void shz_mat4x4_init_perspective(shz_mat4x4_t* mat, float fov, float aspect, float znear)` Initializes the given matrix to a perspective projection matrix.

### Matrix: Decomposition

- [`shz_mat4x4_decompose`](https://sh4zam.com/api/matrix/shz_mat4x4_decompose/): `void shz_mat4x4_decompose(const shz_mat4x4_t* mat, shz_vec3_t* translation, shz_quat_t* rotation, shz_vec3_t* scale)` Decomposes a 4x4 transform matrix into translation, rotation, and scale.

### Matrix: Getting

- [`shz_mat4x4_row`](https://sh4zam.com/api/matrix/shz_mat4x4_row/): `shz_vec4_t shz_mat4x4_row(const shz_mat4x4_t* mat, size_t row)` Extracts the `row` index as a 4D row vector from the given matrix.
- [`shz_mat4x4_col`](https://sh4zam.com/api/matrix/shz_mat4x4_col/): `shz_vec4_t shz_mat4x4_col(const shz_mat4x4_t* mat, size_t col)` Extracts the `col` index as a 4D column vector from the given matrix.
- [`shz_mat4x4_get_translation`](https://sh4zam.com/api/matrix/shz_mat4x4_get_translation/): `shz_vec3_t shz_mat4x4_get_translation(const shz_mat4x4_t* mat)` Returns the translational components from the 4th column as a 3D vector.
- [`shz_mat4x4_get_scale`](https://sh4zam.com/api/matrix/shz_mat4x4_get_scale/): `shz_vec3_t shz_mat4x4_get_scale(const shz_mat4x4_t* mat)` Exracts the 3D scale factors from the given 4x4 matrix.
- [`shz_mat4x4_determinant`](https://sh4zam.com/api/matrix/shz_mat4x4_determinant/): `float shz_mat4x4_determinant(const shz_mat4x4_t* mat)` Returns the determinant of the given 4x4 matrix.
- [`shz_mat4x4_trace`](https://sh4zam.com/api/matrix/shz_mat4x4_trace/): `float shz_mat4x4_trace(const shz_mat4x4_t* mat)` Returns the trace of the given 4x4 matrix.
- [`shz_mat4x4_3x3`](https://sh4zam.com/api/matrix/shz_mat4x4_3x3/): `void shz_mat4x4_3x3(const shz_mat4x4_t* mat4, shz_mat3x3_t* mat3)` Extracts the top-left 3x3 of the given 4D matrix.
- [`shz_mat4x4_3x3_inverse_unscaled`](https://sh4zam.com/api/matrix/shz_mat4x4_3x3_inverse_unscaled/): `void shz_mat4x4_3x3_inverse_unscaled(const shz_mat4x4_t* mat4, shz_mat3x3_t* invmat3)` Extracts and inverts the top-level, unscaled 3x3 of the given 4x4 matrix.
- [`shz_mat4x4_3x3_inverse`](https://sh4zam.com/api/matrix/shz_mat4x4_3x3_inverse/): `void shz_mat4x4_3x3_inverse(const shz_mat4x4_t* mat4, shz_mat3x3_t* invmat3)` Extracts and inverts the top-level 3x3 (which may be scaled) of the given 4x4 matrix.
- [`shz_mat4x4_3x3_determinant`](https://sh4zam.com/api/matrix/shz_mat4x4_3x3_determinant/): `float shz_mat4x4_3x3_determinant(const shz_mat4x4_t* mat)` Returns the determinant of the given 4x4 matrix's internal top-level 3x3 matrix.

### Matrix: Setting

- [`shz_mat4x4_set_row`](https://sh4zam.com/api/matrix/shz_mat4x4_set_row/): `void shz_mat4x4_set_row(shz_mat4x4_t* mat, size_t row, shz_vec4_t vec)` Sets the values of `mat` at the given `row` to those of the 4D vector, `vec`.
- [`shz_mat4x4_set_col`](https://sh4zam.com/api/matrix/shz_mat4x4_set_col/): `void shz_mat4x4_set_col(shz_mat4x4_t* mat, size_t col, shz_vec4_t vec)` Sets the values of `mat` at the given `col` to those of the 4D vector, `vec`.
- [`shz_mat4x4_swap_rows`](https://sh4zam.com/api/matrix/shz_mat4x4_swap_rows/): `void shz_mat4x4_swap_rows(shz_mat4x4_t* mat, size_t row1, size_t row2)` Swaps the 4D row vectors located at `row1` and `row2` within `mat`.
- [`shz_mat4x4_swap_cols`](https://sh4zam.com/api/matrix/shz_mat4x4_swap_cols/): `void shz_mat4x4_swap_cols(shz_mat4x4_t* mat, size_t col1, size_t col2)` Swaps the 4D column vectors located at `col1` and `col2` within `mat`.
- [`shz_mat4x4_set_translation`](https://sh4zam.com/api/matrix/shz_mat4x4_set_translation/): `void shz_mat4x4_set_translation(shz_mat4x4_t* mat, float x, float y, float z)` Assigns only the 3D translation-related elements of the given matrix to the given values.
- [`shz_mat4x4_set_scale`](https://sh4zam.com/api/matrix/shz_mat4x4_set_scale/): `void shz_mat4x4_set_scale(shz_mat4x4_t* mat, float x, float y, float z)` Assigns only the 3D scale-related elements of the given matrix to the given values.
- [`shz_mat4x4_set_rotation_quat`](https://sh4zam.com/api/matrix/shz_mat4x4_set_rotation_quat/): `void shz_mat4x4_set_rotation_quat(shz_mat4x4_t* m, shz_quat_t q)` Sets just the rotational component of the matrix to the orientation given by a quaternion, keeping the other elements in-tact.
- [`shz_mat4x4_set_diagonal`](https://sh4zam.com/api/matrix/shz_mat4x4_set_diagonal/): `void shz_mat4x4_set_diagonal(shz_mat4x4_t* mat, float x, float y, float z, float w)` Assigns only the 4 elements along the diagonal of the given matrix to the given values.

### Matrix: Applying

- [`shz_mat4x4_apply`](https://sh4zam.com/api/matrix/shz_mat4x4_apply/): `void shz_mat4x4_apply(shz_mat4x4_t* dst, const shz_mat4x4_t* src)` Multiplies and accumulates the `src` 4x4 matrix onto the `dst` 4x4 matrix.
- [`shz_mat4x4_apply_unaligned`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_unaligned/): `void shz_mat4x4_apply_unaligned(shz_mat4x4_t* dst, const float src[16])` Multiplies and accumulates the unaligned `src` 4x4 matrix onto the `dst` 4x4 matrix.
- [`shz_mat4x4_apply_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_transpose/): `void shz_mat4x4_apply_transpose(shz_mat4x4_t* dst, const shz_mat4x4_t* src)` Multiplies and accumulates the transposed `src` 4x4 matrix onto the `dst` 4x4 matrix.
- [`shz_mat4x4_apply_transpose_unaligned`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_transpose_unaligned/): `void shz_mat4x4_apply_transpose_unaligned(shz_mat4x4_t* dst, const float src[16])` Multiplies and accumulates the transposed unaligned `src` 4x4 matrix onto the `dst` 4x4 matrix.
- [`shz_mat4x4_apply_translation`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_translation/): `void shz_mat4x4_apply_translation(shz_mat4x4_t* mat, float x, float y, float z)` Adds the given 3D vector components to the translational values of the given matrix.
- [`shz_mat4x4_apply_scale`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_scale/): `void shz_mat4x4_apply_scale(shz_mat4x4_t* mat, float x, float y, float z)` Multiplies and accumulates the scale-related elements of the given matrix by the given 3D components.
- [`shz_mat4x4_apply_rotation_x`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_x/): `void shz_mat4x4_apply_rotation_x(shz_mat4x4_t* mat, float xAngle)` Multiplies and accumulates a rotation matrix by `xAngle` radians about the X-axis onto the given matrix.
- [`shz_mat4x4_apply_rotation_y`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_y/): `void shz_mat4x4_apply_rotation_y(shz_mat4x4_t* mat, float yAngle)` Multiplies and accumulates a rotation matrix by `yAngle` radians about the Y-axis onto the given matrix.
- [`shz_mat4x4_apply_rotation_z`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_z/): `void shz_mat4x4_apply_rotation_z(shz_mat4x4_t* mat, float zAngle)` Multiplies and accumulates a rotation matrix by `zAngle` radians about the Z-axis onto the given matrix.
- [`shz_mat4x4_apply_rotation_xyz`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_xyz/): `void shz_mat4x4_apply_rotation_xyz(shz_mat4x4_t* mat, float xAngle, float yAngle, float zAngle)` Rotates the given transform matrix about the X axis, then the Y axis, then the Z axis by the given angles in radians.
- [`shz_mat4x4_apply_rotation_zyx`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_zyx/): `void shz_mat4x4_apply_rotation_zyx(shz_mat4x4_t* mat, float zAngle, float yAngle, float xAngle)` Rotates the given transform matrix about the Z axis, then the Y axis, then the X axis by the given angles in radians.
- [`shz_mat4x4_apply_rotation_zxy`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_zxy/): `void shz_mat4x4_apply_rotation_zxy(shz_mat4x4_t* mat, float zAngle, float xAngle, float yAngle)` Rotates the given transform matrix about the Z axis, then the X axis, then the Y axis by the given angles in radians.
- [`shz_mat4x4_apply_rotation_yxz`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_yxz/): `void shz_mat4x4_apply_rotation_yxz(shz_mat4x4_t* mat, float yAngle, float xAngle, float zAngle)` Rotates the given transform matrix about the Y axis, then the X axis, then the Z axis by the given angles in radians.
- [`shz_mat4x4_apply_rotation`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation/): `void shz_mat4x4_apply_rotation(shz_mat4x4_t* mat, float angle, float xAxis, float yAxis, float zAxis)` Rotates the given transform matrix about the arbitrary axis given by a 3D direction vector and angle of rotation in radians.
- [`shz_mat4x4_apply_rotation_quat`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_rotation_quat/): `void shz_mat4x4_apply_rotation_quat(shz_mat4x4_t* m, shz_quat_t q)` Multiplies and accumulates the given matrix with a rotation matrix whose orientation is given by a quaternion.
- [`shz_mat4x4_apply_lookat`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_lookat/): `void shz_mat4x4_apply_lookat(shz_mat4x4_t* m, shz_vec3_t pos, shz_vec3_t target, shz_vec3_t up)` Applies the 3D "lookAt" matrix constructed with the given vector components onto the given matrix.
- [`shz_mat4x4_apply_ortho`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_ortho/): `void shz_mat4x4_apply_ortho(shz_mat4x4_t* m, float left, float right, float bottom, float top, float znear, float zfar)` Multiplies and accumulates the ortho matrix constructed from the given values onto the given matrix.
- [`shz_mat4x4_apply_frustum`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_frustum/): `void shz_mat4x4_apply_frustum(shz_mat4x4_t* m, float left, float right, float bottom, float top, float znear, float zfar)` Multiplies and accumulates the frustum matrix constructed from the given values onto the given matrix.
- [`shz_mat4x4_apply_perspective`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_perspective/): `void shz_mat4x4_apply_perspective(shz_mat4x4_t* m, float fov, float aspect, float znear)` Multiplies and accumulates the perspective matrix constructed from the given values onto the given matrix.
- [`shz_mat4x4_apply_screen`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_screen/): `void shz_mat4x4_apply_screen(shz_mat4x4_t* m, float width, float height)` Multiplies and accumulates the viewport matrix created with the given components ont othe given matrix.
- [`shz_mat4x4_apply_symmetric_skew`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_symmetric_skew/): `void shz_mat4x4_apply_symmetric_skew(shz_mat4x4_t* mat, float x, float y, float z)` Multiplies and accumulates the given matrix with a symmetric skew matrix formed from the given 3D vector components.
- [`shz_mat4x4_apply_permutation_wxyz`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_permutation_wxyz/): `void shz_mat4x4_apply_permutation_wxyz(shz_mat4x4_t* mat)` Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors to be in WXYZ order.
- [`shz_mat4x4_apply_permutation_yzwx`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_permutation_yzwx/): `void shz_mat4x4_apply_permutation_yzwx(shz_mat4x4_t* mat)` Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors to be in YZWX order.
- [`shz_mat4x4_apply_self`](https://sh4zam.com/api/matrix/shz_mat4x4_apply_self/): `void shz_mat4x4_apply_self(shz_mat4x4_t* mat)` Multiplies and accumulates the given matrix onto itself.

### Matrix: GL Transformations

- [`shz_mat4x4_translate`](https://sh4zam.com/api/matrix/shz_mat4x4_translate/): `void shz_mat4x4_translate(shz_mat4x4_t* mat, float x, float y, float z)` Multiplies and accumulates `mat` by a 3D translation matrix with the given components.
- [`shz_mat4x4_scale`](https://sh4zam.com/api/matrix/shz_mat4x4_scale/): `void shz_mat4x4_scale(shz_mat4x4_t* mat, float x, float y, float z)` Multiplies and accumulates `mat` by a 3D scaling matrix with the given components.
- [`shz_mat4x4_rotate_x`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_x/): `void shz_mat4x4_rotate_x(shz_mat4x4_t* mat, float radians)` Multiplies and accumulates `mat` by a 3D rotation matrix about the X axis.
- [`shz_mat4x4_rotate_y`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_y/): `void shz_mat4x4_rotate_y(shz_mat4x4_t* mat, float radians)` Multiplies and accumulates `mat` by a 3D rotation matrix about the Y axis.
- [`shz_mat4x4_rotate_z`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_z/): `void shz_mat4x4_rotate_z(shz_mat4x4_t* mat, float radians)` Multiplies and accumulates `mat` by a 3D rotation matrix about the Z axis.
- [`shz_mat4x4_rotate_xyz`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_xyz/): `void shz_mat4x4_rotate_xyz(shz_mat4x4_t* mat, float xRadians, float yRadians, float zRadians)` Multiplies and accumulates `mat` by 3D rotation matrices about the X then Y then Z axes.
- [`shz_mat4x4_rotate_zyx`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_zyx/): `void shz_mat4x4_rotate_zyx(shz_mat4x4_t* mat, float zRadians, float yRadians, float xRadians)` Multiplies and accumulates `mat` by 3D rotation matrices about the Z then Y then X axes.
- [`shz_mat4x4_rotate_zxy`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_zxy/): `void shz_mat4x4_rotate_zxy(shz_mat4x4_t* mat, float zRadians, float xRadians, float yRadians)` Multiplies and accumulates `mat` by 3D rotation matrices about the Z then X then Y axes.
- [`shz_mat4x4_rotate_yxz`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate_yxz/): `void shz_mat4x4_rotate_yxz(shz_mat4x4_t* mat, float yRadians, float xRadians, float zRadians)` Multiplies and accumulates `mat` by 3D rotation matrices about the Y then X then Z axes.
- [`shz_mat4x4_rotate`](https://sh4zam.com/api/matrix/shz_mat4x4_rotate/): `void shz_mat4x4_rotate(shz_mat4x4_t* mat, float radians, float xAxis, float yAxis, float zAxis)` Multiplies and accumulates `mat` by the 3D rotation matrix formed by the given axis and angle.

### Matrix: Reverse GL Transformations

- [`shz_mat4x4_translate_reverse`](https://sh4zam.com/api/matrix/shz_mat4x4_translate_reverse/): `void shz_mat4x4_translate_reverse(shz_mat4x4_t* mat, float x, float y, float z)` Pre-multiplies and accumulates the given matrix onto the 3D translation matrix with the given components.
- [`shz_mat4x4_scale_reverse`](https://sh4zam.com/api/matrix/shz_mat4x4_scale_reverse/): `void shz_mat4x4_scale_reverse(shz_mat4x4_t* mat, float x, float y, float z)` Pre-multiplies and accumulates the given matrix onto the 3D scaling matrix with the given components.

### Matrix: Transforming

- [`shz_mat4x4_mult`](https://sh4zam.com/api/matrix/shz_mat4x4_mult/): `void shz_mat4x4_mult(shz_mat4x4_t* mat, const shz_mat4x4_t* lhs, const shz_mat4x4_t* rhs)` Multiplies two 4x4 matrices together, storing the result into a third.
- [`shz_mat4x4_mult_unaligned`](https://sh4zam.com/api/matrix/shz_mat4x4_mult_unaligned/): `void shz_mat4x4_mult_unaligned(shz_mat4x4_t* mat, const shz_mat4x4_t* lhs, const float rhs[16])` Multiplies two 4x4 matrices together, with the right handed matrix being unaligned, storing the result into a third.
- [`shz_mat4x4_mult_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_mult_transpose/): `void shz_mat4x4_mult_transpose(shz_mat4x4_t* mat, const shz_mat4x4_t* lhs, const shz_mat4x4_t* rhs)` Multiplies the regular matrix, `lhs`, by the transpose of the matrix, `rhs`, storing the result into `mat`.
- [`shz_mat4x4_mult_transpose_unaligned`](https://sh4zam.com/api/matrix/shz_mat4x4_mult_transpose_unaligned/): `void shz_mat4x4_mult_transpose_unaligned(shz_mat4x4_t* mat, const shz_mat4x4_t* lhs, const float rhs[16])` Multiplies the regular matrix, `lhs`, by the transpose of the unaligned matrix, `rhs`, storing the result into `mat`.
- [`shz_mat4x4_transform_vec2`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec2/): `shz_vec2_t shz_mat4x4_transform_vec2(const shz_mat4x4_t* m, shz_vec2_t v)` Transforms a 2D vector by a 4x4 matrix.
- [`shz_mat4x4_transform_vec3`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec3/): `shz_vec3_t shz_mat4x4_transform_vec3(const shz_mat4x4_t* m, shz_vec3_t v)` Transforms a 3D vector by a 4x4 matrix.
- [`shz_mat4x4_transform_vec4`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec4/): `shz_vec4_t shz_mat4x4_transform_vec4(const shz_mat4x4_t* mat, shz_vec4_t in)` Transforms a 4D vector by a 4x4 matrix.
- [`shz_mat4x4_transform_vec2_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec2_transpose/): `shz_vec2_t shz_mat4x4_transform_vec2_transpose(const shz_mat4x4_t* m, shz_vec2_t v)` Transforms a 2D vector the the transpose of a 4x4 matrix.
- [`shz_mat4x4_transform_vec3_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec3_transpose/): `shz_vec3_t shz_mat4x4_transform_vec3_transpose(const shz_mat4x4_t* m, shz_vec3_t v)` Transforms a 3D vector the the transpose of a 4x4 matrix.
- [`shz_mat4x4_transform_vec4_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_vec4_transpose/): `shz_vec4_t shz_mat4x4_transform_vec4_transpose(const shz_mat4x4_t* m, shz_vec4_t v)` Transforms a 4D vector the the transpose of a 4x4 matrix.
- [`shz_mat4x4_transform_point2`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_point2/): `shz_vec2_t shz_mat4x4_transform_point2(const shz_mat4x4_t* mat, shz_vec2_t pt)` Transforms a 2D point by a 4x4 matrix.
- [`shz_mat4x4_transform_point3`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_point3/): `shz_vec3_t shz_mat4x4_transform_point3(const shz_mat4x4_t* mat, shz_vec3_t pt)` Transforms a 3D point by a 4x4 matrix.
- [`shz_mat4x4_transform_point2_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_point2_transpose/): `shz_vec2_t shz_mat4x4_transform_point2_transpose(const shz_mat4x4_t* mat, shz_vec2_t pt)` Transforms a 2D point by the transpose of a 4x4 matrix.
- [`shz_mat4x4_transform_point3_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transform_point3_transpose/): `shz_vec3_t shz_mat4x4_transform_point3_transpose(const shz_mat4x4_t* mat, shz_vec3_t pt)` Transforms a 3D point by the transpose of a 4x4 matrix.

### Matrix: Miscellaneous

- [`shz_mat4x4_to_quat`](https://sh4zam.com/api/matrix/shz_mat4x4_to_quat/): `shz_quat_t shz_mat4x4_to_quat(const shz_mat4x4_t* mat)` Converts the given 4x4 orientation matrix into a quaternion.
- [`shz_mat4x4_transpose`](https://sh4zam.com/api/matrix/shz_mat4x4_transpose/): `void shz_mat4x4_transpose(const shz_mat4x4_t* mat, shz_mat4x4_t* out)` Stores the transpose of `mat` within `out`.
- [`shz_mat4x4_inverse`](https://sh4zam.com/api/matrix/shz_mat4x4_inverse/): `void shz_mat4x4_inverse(const shz_mat4x4_t* SHZ_RESTRICT mtrx, shz_mat4x4_t* SHZ_RESTRICT out)` Computes the inverse of a 4x4 matrix.
- [`shz_mat4x4_inverse_block_triangular`](https://sh4zam.com/api/matrix/shz_mat4x4_inverse_block_triangular/): `void shz_mat4x4_inverse_block_triangular(const shz_mat4x4_t* mtx, shz_mat4x4_t* out)` Computes the inverse of a 4x4 matrix in block-triangular form.
- [`shz_mat4x4_equal`](https://sh4zam.com/api/matrix/shz_mat4x4_equal/): `bool shz_mat4x4_equal(const shz_mat4x4_t* SHZ_RESTRICT mat1, const shz_mat4x4_t* mat2)` Returns true if the two matrices are equal, based on either absolute or relative tolerance.
- [`shz_mat4x4_is_block_triangular`](https://sh4zam.com/api/matrix/shz_mat4x4_is_block_triangular/): `bool shz_mat4x4_is_block_triangular(const shz_mat4x4_t* mat)` Returns true if the given matrix is in block-triangular form: having a bottom row in the form of `<0.0f, 0.0f, 0.0f, w>`.
- [`shz_mat4x4_copy`](https://sh4zam.com/api/matrix/shz_mat4x4_copy/): `void shz_mat4x4_copy(shz_mat4x4_t* dst, const shz_mat4x4_t* src)` Copies the given `src` 4x4 matrix into the given `dst` 4x4 matrix.
- [`shz_mat4x4_copy_unaligned`](https://sh4zam.com/api/matrix/shz_mat4x4_copy_unaligned/): `void shz_mat4x4_copy_unaligned(shz_mat4x4_t* dst, const float src[16])` Copies the given unaligned `src` 4x4 matrix into the given `dst` 4x4 matrix.
- [`shz_mat4x4_swap`](https://sh4zam.com/api/matrix/shz_mat4x4_swap/): `void shz_mat4x4_swap(shz_mat4x4_t* matA, shz_mat4x4_t* matB)` Swaps the contents of the two given matrices, `matA` and `matB`.
- [`shz_mat4x4_blend`](https://sh4zam.com/api/matrix/shz_mat4x4_blend/): `void shz_mat4x4_blend(shz_mat4x4_t* dst, const shz_mat4x4_t* matrix, float weights)` Adds and accumulates a scaled 4x4 matrix into the given matrix.

### Matrix: Types

- [`shz_mat4x4_t`](https://sh4zam.com/api/matrix/shz_mat4x4_t/): `struct shz_mat4x4_t` Structure representing a 4x4 column-major matrix.
- [`shz_mat4x4`](https://sh4zam.com/api/matrix/shz_mat4x4/): `typedef shz_mat4x4_t shz_mat4x4` Alternate `shz_mat4x4_t` C typedef for those who hate POSIX style.
- [`shz_mat2x2_t`](https://sh4zam.com/api/matrix/shz_mat2x2_t/): `struct shz_mat2x2_t` Structure representing a 2x2 column-major matrix.
- [`shz_mat3x3_t`](https://sh4zam.com/api/matrix/shz_mat3x3_t/): `struct shz_mat3x3_t` Structure representing a 3x3 column-major matrix.
- [`shz_mat3x4_t`](https://sh4zam.com/api/matrix/shz_mat3x4_t/): `struct shz_mat3x4_t` Structure representing a 3x4 column-major matrix.
- [`shz_mat4x3_t`](https://sh4zam.com/api/matrix/shz_mat4x3_t/): `struct shz_mat4x3_t` Structure representing a 4x3 column-major matrix.

### Matrix: Functions

- [`shz_mat3x3_transpose`](https://sh4zam.com/api/matrix/shz_mat3x3_transpose/): `void shz_mat3x3_transpose(const shz_mat3x3_t* mat, shz_mat3x3_t* out)` Stores the transpose of 3x3 matrix `mat` within `out`.
- [`shz_mat3x3_inverse_unscaled`](https://sh4zam.com/api/matrix/shz_mat3x3_inverse_unscaled/): `void shz_mat3x3_inverse_unscaled(const shz_mat3x3_t* mat, shz_mat3x3_t* out)` Computes the inverse of an orthonormal 3x3 matrix.
- [`shz_mat3x3_inverse`](https://sh4zam.com/api/matrix/shz_mat3x3_inverse/): `void shz_mat3x3_inverse(const shz_mat3x3_t* mat, shz_mat3x3_t* out)` Computes the inverse of a 3x3 matrix.
- [`shz_mat3x3_scale`](https://sh4zam.com/api/matrix/shz_mat3x3_scale/): `void shz_mat3x3_scale(shz_mat3x3_t* dst, const shz_mat3x3_t* src, float value)` Uniformly scales each element within a 3x3 matrix by the given value.
- [`shz_mat3x3_transform_vec3`](https://sh4zam.com/api/matrix/shz_mat3x3_transform_vec3/): `shz_vec3_t shz_mat3x3_transform_vec3(const shz_mat3x3_t* m, shz_vec3_t v)` Transforms an input vector by a 3x3 matrix, returning the resulting vector.
- [`shz_mat3x3_transform_vec3_transpose`](https://sh4zam.com/api/matrix/shz_mat3x3_transform_vec3_transpose/): `shz_vec3_t shz_mat3x3_transform_vec3_transpose(const shz_mat3x3_t* m, shz_vec3_t v)` Transforms an input vector by the transpose of a 3x3 matrix, returning the resulting vector.

## XMTRX

`#include <sh4zam/shz_xmtrx.h>` · [module page](https://sh4zam.com/api/xmtrx/)

### XMTRX: Accessors

- [`shz_xmtrx_read`](https://sh4zam.com/api/xmtrx/shz_xmtrx_read/): `float shz_xmtrx_read(shz_xmtrx_reg_t xf)` Returns the floating-point value held within the given XMTRX register.
- [`shz_xmtrx_write`](https://sh4zam.com/api/xmtrx/shz_xmtrx_write/): `void shz_xmtrx_write(shz_xmtrx_reg_t xf, float value)` Sets the floating-point value held within the given XMTRX register to `value`.
- [`shz_xmtrx_read_row`](https://sh4zam.com/api/xmtrx/shz_xmtrx_read_row/): `shz_vec4_t shz_xmtrx_read_row(unsigned int index)` Returns the values at the the given row `index`, as a 4D vector.
- [`shz_xmtrx_read_col`](https://sh4zam.com/api/xmtrx/shz_xmtrx_read_col/): `shz_vec4_t shz_xmtrx_read_col(unsigned int index)` Returns the values at the given column `index`, as a 4D vector.
- [`shz_xmtrx_write_row`](https://sh4zam.com/api/xmtrx/shz_xmtrx_write_row/): `void shz_xmtrx_write_row(unsigned int index, shz_vec4_t vector)` Sets the values at the given row `index` to the given 4D vector.
- [`shz_xmtrx_write_col`](https://sh4zam.com/api/xmtrx/shz_xmtrx_write_col/): `void shz_xmtrx_write_col(unsigned int index, shz_vec4_t vector)` Sets the values at the given column `index` to the given 4D vector.
- [`shz_xmtrx_swap_rows`](https://sh4zam.com/api/xmtrx/shz_xmtrx_swap_rows/): `void shz_xmtrx_swap_rows(unsigned int index1, unsigned int index2)` Swaps the values of the rows with the given indices.
- [`shz_xmtrx_swap_cols`](https://sh4zam.com/api/xmtrx/shz_xmtrx_swap_cols/): `void shz_xmtrx_swap_cols(unsigned int index1, unsigned int index2)` Swaps the values of the columns with the given indices.

### XMTRX: Loading

- [`shz_xmtrx_load_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_4x4/): `void shz_xmtrx_load_4x4(const shz_mat4x4_t* matrix)` Loads the given 4x4 matrix as XMTRX.
- [`shz_xmtrx_load_wxyz_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_wxyz_4x4/): `void shz_xmtrx_load_wxyz_4x4(const shz_mat4x4_t* matrix)` Loads the given 4x4 matrix as XMTRX, with the 4th column for translation being loaded as the first column.
- [`shz_xmtrx_load_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_unaligned_4x4/): `void shz_xmtrx_load_unaligned_4x4(const float matrix[16])` Loads the given array of unaligned 16 float values as the 4x4 XMTRX matrix.
- [`shz_xmtrx_load_cols_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_cols_4x4/): `void shz_xmtrx_load_cols_4x4(const shz_vec4_t* c1, const shz_vec4_t* c2, const shz_vec4_t* c3, const shz_vec4_t* c4)` Sets XMTRX equal to the 4x4 matrix created from the 4 given 4D column vectors.
- [`shz_xmtrx_load_rows_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_rows_4x4/): `void shz_xmtrx_load_rows_4x4(const shz_vec4_t* r1, const shz_vec4_t* r2, const shz_vec4_t* r3, const shz_vec4_t* r4)` Sets XMTRX equal to the 4x4 matrix created from the 4 given 4D row vectors.
- [`shz_xmtrx_load_transpose_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_transpose_4x4/): `void shz_xmtrx_load_transpose_4x4(const shz_mat4x4_t* matrix)` Loads XMTRX with the transpose of the given 4x4 matrix.
- [`shz_xmtrx_load_transpose_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_transpose_unaligned_4x4/): `void shz_xmtrx_load_transpose_unaligned_4x4(const float matrix[16])` Loads XMTRX with the transpose of the 4x4 matrix created from the given unaligned array of 16 floats.
- [`shz_xmtrx_load_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_3x4/): `void shz_xmtrx_load_3x4(const shz_mat3x4_t* matrix)` Loads the given 3x4 matrix into XMTRX, initializing its remaining elements to identity.
- [`shz_xmtrx_load_transpose_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_transpose_3x4/): `void shz_xmtrx_load_transpose_3x4(const shz_mat3x4_t* matrix)` Loads XMTRX with the transpose of the given 3x4 matrix, initializing the bottom row to identity.
- [`shz_xmtrx_load_cols_4x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_cols_4x3/): `void shz_xmtrx_load_cols_4x3(const shz_vec4_t* c1, const shz_vec4_t* c2, const shz_vec4_t* c3)` Loads the 3x4 matrix formed from the given 3 4D column vectors into XMTRX.
- [`shz_xmtrx_load_rows_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_rows_3x4/): `void shz_xmtrx_load_rows_3x4(const shz_vec4_t* r1, const shz_vec4_t* r2, const shz_vec4_t* r3)` Loads the 3x4 matrix formed from the given 3 4D row vectors into XMTRX.
- [`shz_xmtrx_load_cols_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_cols_3x4/): `void shz_xmtrx_load_cols_3x4(const shz_vec3_t* c1, const shz_vec3_t* c2, const shz_vec3_t* c3, const shz_vec3_t* c4)` Loads the 3x4 matrix formed from the given 4 3D column vectors into XMTRX.
- [`shz_xmtrx_load_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_3x3/): `void shz_xmtrx_load_3x3(const shz_mat3x3_t* matrix)` Loads the given 3x3 matrix into XMTRX, initalizing its remaining elements to identity.
- [`shz_xmtrx_load_transpose_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_transpose_3x3/): `void shz_xmtrx_load_transpose_3x3(const shz_mat3x3_t* matrix)` Loads the transpose of the given 3x3 matrix into XMTRX, initializing its remaining elements to identity.
- [`shz_xmtrx_load_2x2`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_2x2/): `void shz_xmtrx_load_2x2(const shz_mat2x2_t* matrix)` Loads the given 2x2 matrix into XMTRX, initializing its remaining elements to identity.

### XMTRX: Storing

- [`shz_xmtrx_store_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_4x4/): `void shz_xmtrx_store_4x4(shz_mat4x4_t* matrix)` Stores the current values held within XMTRX into the given 4x4 matrix.
- [`shz_xmtrx_store_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_unaligned_4x4/): `void shz_xmtrx_store_unaligned_4x4(float matrix[16])` Stores the current values held within XMTRX into the given unaligned 16-float array.
- [`shz_xmtrx_store_transpose_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_transpose_4x4/): `void shz_xmtrx_store_transpose_4x4(shz_mat4x4_t* matrix)` Stores the transpose of the current values held within XMTRX into the given 4x4 matrix.
- [`shz_xmtrx_store_transpose_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_transpose_unaligned_4x4/): `void shz_xmtrx_store_transpose_unaligned_4x4(float matrix[16])` Stores the transpose of the the current values held within XMTRX into the given 16-element float array.
- [`shz_xmtrx_store_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_3x4/): `void shz_xmtrx_store_3x4(shz_mat3x4_t* matrix)` Stores the top-left 3x4 values currently held within XMTRX into the given matrix.
- [`shz_xmtrx_store_transpose_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_transpose_3x4/): `void shz_xmtrx_store_transpose_3x4(shz_mat3x4_t* matrix)` Stores the transpose of the top-left 3x4 values currently held within XMTRX into the given matrix.
- [`shz_xmtrx_store_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_3x3/): `void shz_xmtrx_store_3x3(shz_mat3x3_t* matrix)` Stores the top-left 3x3 values currently held within XMTRX into the given matrix.
- [`shz_xmtrx_store_transpose_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_transpose_3x3/): `void shz_xmtrx_store_transpose_3x3(shz_mat3x3_t* matrix)` Stores the transpose of the top-left 3x3 values currently held within XMTRX into the given matrix.
- [`shz_xmtrx_store_2x2`](https://sh4zam.com/api/xmtrx/shz_xmtrx_store_2x2/): `void shz_xmtrx_store_2x2(shz_mat2x2_t* matrix)` Stores the top-left 2x2 values currently held within XMTRX into the given matrix.

### XMTRX: Initialization

- [`shz_xmtrx_init_identity`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_identity/): `void shz_xmtrx_init_identity(void)` Initializes XMTRX to the 4x4 identity matrix.
- [`shz_xmtrx_init_identity_safe`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_identity_safe/): `void shz_xmtrx_init_identity_safe(void)` Safely initializes XMTRX to be a 4D identity matrix.
- [`shz_xmtrx_init_zero`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_zero/): `void shz_xmtrx_init_zero(void)` Initializes XMTRX to contain the value of 0.0f for each element.
- [`shz_xmtrx_init_one`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_one/): `void shz_xmtrx_init_one(void)` Initializes XMTRX to contain the value of 1.0f for each element.
- [`shz_xmtrx_init_fill`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_fill/): `void shz_xmtrx_init_fill(float value)` Initializes XMTRX to contain the given `value` for each element.
- [`shz_xmtrx_init_translation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_translation/): `void shz_xmtrx_init_translation(float x, float y, float z)` Initializes XMTRX to be a 3D translation matrix to the given coordinates.
- [`shz_xmtrx_init_scale`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_scale/): `void shz_xmtrx_init_scale(float x, float y, float z)` Initializes XMTRX to be a 3D scale matrix with the given dimensions.
- [`shz_xmtrx_init_rotation_x`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_x/): `void shz_xmtrx_init_rotation_x(float x)` Initializes XMTRX to be a 3D rotation matrix by `x` radians about the X axis.
- [`shz_xmtrx_init_rotation_y`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_y/): `void shz_xmtrx_init_rotation_y(float y)` Initializes XMTRX to be a 3D rotation matrix by `y` radians about the Y axis.
- [`shz_xmtrx_init_rotation_z`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_z/): `void shz_xmtrx_init_rotation_z(float z)` Initializes XMTRX to be a 3D rotation matrix by `z` radians about the Z axis.
- [`shz_xmtrx_init_rotation_xyz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_xyz/): `void shz_xmtrx_init_rotation_xyz(float xAngle, float yAngle, float zAngle)` Initializes XMTRX to be a 3D X-Y-Z rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_init_rotation_zyx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_zyx/): `void shz_xmtrx_init_rotation_zyx(float zAngle, float yAngle, float xAngle)` Initializes XMTRX to be a 3D Z-Y-X rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_init_rotation_zxy`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_zxy/): `void shz_xmtrx_init_rotation_zxy(float zAngle, float xAngle, float yAngle)` Initializes XMTRX to be a 3D Z-X-Y rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_init_rotation_yxz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_yxz/): `void shz_xmtrx_init_rotation_yxz(float yAngle, float xAngle, float zAngle)` Initializes XMTRX to be a 3D Y-X-Z rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_init_rotation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation/): `void shz_xmtrx_init_rotation(float angle, float xAxis, float yAxis, float zAxis)` Initializes XMTRX to a 3D rotation matrix of `angle` radians about the vector with the given components.
- [`shz_xmtrx_init_rotation_dir`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_dir/): `void shz_xmtrx_init_rotation_dir(float angle, float x, float y, float z)` Initializes XMTRX to contain a 3D rotation matrix of `angle` radians about the given `axis`.
- [`shz_xmtrx_init_diagonal`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_diagonal/): `void shz_xmtrx_init_diagonal(float x, float y, float z, float w)` Initializes XMTRX to be a diagonal matrix with the given diagonal values.
- [`shz_xmtrx_init_upper_triangular`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_upper_triangular/): `void shz_xmtrx_init_upper_triangular(float col1, shz_vec2_t col2, shz_vec3_t col3, shz_vec4_t col4)` Initializes XMTRX to be an upper triangular matrix with the given column values.
- [`shz_xmtrx_init_lower_triangular`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_lower_triangular/): `void shz_xmtrx_init_lower_triangular(shz_vec4_t col1, shz_vec3_t col2, shz_vec2_t col3, float col4)` Initializes XMTRX to be a lower triangular matrix with the given column values.
- [`shz_xmtrx_init_symmetric_skew`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_symmetric_skew/): `void shz_xmtrx_init_symmetric_skew(float x, float y, float z)` Initializes XMTRX to be the 3D symmetric skew matrix formed from the given vector components.
- [`shz_xmtrx_init_outer_product`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_outer_product/): `void shz_xmtrx_init_outer_product(shz_vec4_t x, shz_vec4_t y)` Initializes XMTRX to the 4D matrix resulting from taking the outer product of the two 4D vectors.
- [`shz_xmtrx_init_permutation_wxyz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_permutation_wxyz/): `void shz_xmtrx_init_permutation_wxyz(void)` Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be in WXYZ order.
- [`shz_xmtrx_init_permutation_yzwx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_permutation_yzwx/): `void shz_xmtrx_init_permutation_yzwx(void)` Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be in YZWX order.
- [`shz_xmtrx_init_permutation_wzyx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_permutation_wzyx/): `void shz_xmtrx_init_permutation_wzyx(void)` Initializes XMTRX to a permutation matrix, which reorders the components of transformed vectors to be in WZYX order.
- [`shz_xmtrx_init_screen`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_screen/): `void shz_xmtrx_init_screen(float width, float height)` Initializes XMTRX to the viewport matrix with the given dimensions.
- [`shz_xmtrx_init_lookat`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_lookat/): `void shz_xmtrx_init_lookat(shz_vec3_t eye, shz_vec3_t center, shz_vec3_t up)` Initializes XMTRX to a "lookAt" view matrix, equivalent to gluLookAt().
- [`shz_xmtrx_init_ortho`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_ortho/): `void shz_xmtrx_init_ortho(float left, float right, float bottom, float top, float znear, float zfar)` Initializes XMTRX to an orthographic projection matrix, equivalent to glOrtho().
- [`shz_xmtrx_init_frustum`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_frustum/): `void shz_xmtrx_init_frustum(float left, float right, float bottom, float top, float znear, float zfar)` Initializes XMTRX to a frustum projection matrix, equivalent to glFrustum().
- [`shz_xmtrx_init_perspective`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_perspective/): `void shz_xmtrx_init_perspective(float fov, float aspect, float znear)` Initializes XMTRX to a perspective projection matrix.
- [`shz_xmtrx_init_rotation_quat`](https://sh4zam.com/api/xmtrx/shz_xmtrx_init_rotation_quat/): `void shz_xmtrx_init_rotation_quat(shz_quat_t q)` Initializes XMTRX to a 3D rotation matrix with its orientation given by a quaternion.

### XMTRX: Apply Operation

- [`shz_xmtrx_apply_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_4x4/): `void shz_xmtrx_apply_4x4(const shz_mat4x4_t* matrix)` Multiplies and accumulates the given 4x4 matrix onto XMTRX.
- [`shz_xmtrx_apply_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_unaligned_4x4/): `void shz_xmtrx_apply_unaligned_4x4(const float matrix[16])` Multiplies and accumulates the given 16-entry float array as a 4x4 matrix onto XMTRX.
- [`shz_xmtrx_apply_transpose_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_transpose_4x4/): `void shz_xmtrx_apply_transpose_4x4(const shz_mat4x4_t* matrix)` Multiplies and accumulates the transpose of the given 4x4 matrix onto XMTRX.
- [`shz_xmtrx_apply_transpose_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_transpose_unaligned_4x4/): `void shz_xmtrx_apply_transpose_unaligned_4x4(const float matrix[16])` Multiplies and accumulates the transpose of the given 16-entry float array as a 4x4 matrix onto XMTRX.
- [`shz_xmtrx_apply_reverse_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_4x4/): `void shz_xmtrx_apply_reverse_4x4(const shz_mat4x4_t* matrix)` Multiplies and accumulates XMTRX onto `matrix`, storing the result as XMTRX.
- [`shz_xmtrx_apply_reverse_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_unaligned_4x4/): `void shz_xmtrx_apply_reverse_unaligned_4x4(const float matrix[16])` Multiplies and accumulates XMTRX onto the given float array as a 4x4 matrix, storing the result as XMTRX.
- [`shz_xmtrx_apply_reverse_transpose_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_transpose_4x4/): `void shz_xmtrx_apply_reverse_transpose_4x4(const shz_mat4x4_t* matrix)` Multiplies and accumulates XMTRX onto the transpose of `matrix`, storing the result as XMTRX.
- [`shz_xmtrx_apply_reverse_transpose_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_transpose_unaligned_4x4/): `void shz_xmtrx_apply_reverse_transpose_unaligned_4x4(const float matrix[16])` Multiplies and accumulates XMTRX onto the transpose of the given float array as a 4x4 matrix, storing the result as XMTRX.
- [`shz_xmtrx_apply_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_3x4/): `void shz_xmtrx_apply_3x4(const shz_mat3x4_t* matrix)` Multiplies and accumulates the given 3x4 matrix onto XMTRX, not modifying other elements.
- [`shz_xmtrx_apply_transpose_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_transpose_3x4/): `void shz_xmtrx_apply_transpose_3x4(const shz_mat3x4_t* matrix)` Multiplies and accumulates the transpose of the given 3x4 matrix onto XMTRX, not modifying other elements.
- [`shz_xmtrx_apply_reverse_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_3x4/): `void shz_xmtrx_apply_reverse_3x4(const shz_mat3x4_t* mat)` Multiplies and accumulates XMTRX onto `matrix`, storing the result as XMTRX.
- [`shz_xmtrx_apply_reverse_transpose_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_reverse_transpose_3x4/): `void shz_xmtrx_apply_reverse_transpose_3x4(const shz_mat3x4_t* mat)` Multiplies and accumulates XMTRX onto the transpose of `matrix`, storing the result as XMTRX.
- [`shz_xmtrx_apply_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_3x3/): `void shz_xmtrx_apply_3x3(const shz_mat3x3_t* matrix)` Multiplies and accumulates the given 3x3 matrix onto XMTRX, not modifying other elements.
- [`shz_xmtrx_apply_transpose_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_transpose_3x3/): `void shz_xmtrx_apply_transpose_3x3(const shz_mat3x3_t* matrix)` Multiplies and accumulates the transpose of the given 3x3 matrix onto XMTRX, not modifying other elements.
- [`shz_xmtrx_apply_2x2`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_2x2/): `void shz_xmtrx_apply_2x2(const shz_mat2x2_t* matrix)` Multiplies and accumulates the given 2x2 matrix onto XMTRX, not modifying other elements.
- [`shz_xmtrx_apply_translation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_translation/): `void shz_xmtrx_apply_translation(float x, float y, float z)` Adds the values of the given 3 components to the 3D translation components of XMTRX.
- [`shz_xmtrx_apply_scale`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_scale/): `void shz_xmtrx_apply_scale(float x, float y, float z)` Multiplies the values of the inner 3x3 matrix by the given 3D scaling terms.
- [`shz_xmtrx_apply_rotation_x`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_x/): `void shz_xmtrx_apply_rotation_x(float x)` Transforms the values of the inner 3x3 matrix by a rotation matrix of `x` radians about the X axis.
- [`shz_xmtrx_apply_rotation_y`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_y/): `void shz_xmtrx_apply_rotation_y(float y)` Transforms the values of the inner 3x3 matrix by a rotation matrix of `y` radians about the Y axis.
- [`shz_xmtrx_apply_rotation_z`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_z/): `void shz_xmtrx_apply_rotation_z(float z)` Transforms the values of the inner 3x3 matrix by a rotation matrix of `z` radians about the Z axis.
- [`shz_xmtrx_apply_rotation_xyz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_xyz/): `void shz_xmtrx_apply_rotation_xyz(float xAngle, float yAngle, float zAngle)` Multiplies and accumulates XMTRX by a 3D X-Y-Z rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_apply_rotation_zyx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_zyx/): `void shz_xmtrx_apply_rotation_zyx(float zAngle, float yAngle, float xAngle)` Multiplies and accumulates XMTRX by a 3D Z-Y-X rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_apply_rotation_zxy`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_zxy/): `void shz_xmtrx_apply_rotation_zxy(float zAngle, float xAngle, float yAngle)` Multiplies and accumulates XMTRX by a 3D Z-X-Y rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_apply_rotation_yxz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_yxz/): `void shz_xmtrx_apply_rotation_yxz(float yAngle, float xAngle, float zAngle)` Multiplies and accumulates XMTRX by a 3D Y-X-Z rotation matrix, with the corresponding angles given in radians.
- [`shz_xmtrx_apply_rotation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation/): `void shz_xmtrx_apply_rotation(float angle, float x, float y, float z)` Transforms the values of the inner 3x3 matrix by a rotation matrix of `angle` radians about the axis with the given components.
- [`shz_xmtrx_apply_rotation_quat`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_rotation_quat/): `void shz_xmtrx_apply_rotation_quat(shz_quat_t quat)` Transforms the values of the inner 3x3 matrix by the rotation matrix represented by the given quaternion.
- [`shz_xmtrx_apply_lookat`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_lookat/): `void shz_xmtrx_apply_lookat(shz_vec3_t eye, shz_vec3_t center, shz_vec3_t up)` Applies the 3D "lookAt" matrix constructed with the given vector components onto XMTRX. Equivalent to gluLookAt().
- [`shz_xmtrx_apply_ortho`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_ortho/): `void shz_xmtrx_apply_ortho(float left, float right, float bottom, float top, float znear, float zfar)` Applies a 2D orthographic projection matrix onto XMTRX, equivalent to glOrtho().
- [`shz_xmtrx_apply_frustum`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_frustum/): `void shz_xmtrx_apply_frustum(float left, float right, float bottom, float top, float znear, float zfar)` Applies a frustum projection matrix onto XMTRX, equivalent to glFrustum().
- [`shz_xmtrx_apply_perspective`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_perspective/): `void shz_xmtrx_apply_perspective(float fov, float aspect, float znear)` Multiplies and accumulates the perspective matrix constructed from the given values onto XMTRX.
- [`shz_xmtrx_apply_screen`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_screen/): `void shz_xmtrx_apply_screen(float width, float height)` Multiplies and accumulates the viewport matrix created with the given components.
- [`shz_xmtrx_apply_symmetric_skew`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_symmetric_skew/): `void shz_xmtrx_apply_symmetric_skew(float x, float y, float z)` Multiplies and accumulates the 3D symmetric skew matrix with the given components onto XMTRX.
- [`shz_xmtrx_apply_permutation_wxyz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_permutation_wxyz/): `void shz_xmtrx_apply_permutation_wxyz(void)` Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors to be in WXYZ order.
- [`shz_xmtrx_apply_permutation_yzwx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_permutation_yzwx/): `void shz_xmtrx_apply_permutation_yzwx(void)` Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors to be in YZWX order.
- [`shz_xmtrx_apply_permutation_wzyx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_permutation_wzyx/): `void shz_xmtrx_apply_permutation_wzyx(void)` Multiplies and accumulates a permutation matrix, which reorders the components of transformed vectors to be in WZYX order.
- [`shz_xmtrx_apply_self`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_self/): `void shz_xmtrx_apply_self(void)` Multiplies and accumulatse the XMTRX matrix by itself, squaring it.

### XMTRX: GL Transformations

- [`shz_xmtrx_translate`](https://sh4zam.com/api/xmtrx/shz_xmtrx_translate/): `void shz_xmtrx_translate(float x, float y, float z)` Multiplies and accumulates XMTRX by a 3D translation matrix with the given components (glTranslatef() equivalent).
- [`shz_xmtrx_scale`](https://sh4zam.com/api/xmtrx/shz_xmtrx_scale/): `void shz_xmtrx_scale(float x, float y, float z)` Multiplies and accumulates XMTRX by a 3D scaling matrix with the given components (glScalef() equivalent).
- [`shz_xmtrx_rotate_x`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_x/): `void shz_xmtrx_rotate_x(float radians)` Multiplies and accumulates XMTRX by a 3D rotation matrix about the X axis.
- [`shz_xmtrx_rotate_y`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_y/): `void shz_xmtrx_rotate_y(float radians)` Multiplies and accumulates XMTRX by a 3D rotation matrix about the Y axis.
- [`shz_xmtrx_rotate_z`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_z/): `void shz_xmtrx_rotate_z(float radians)` Multiplies and accumulates XMTRX by a 3D rotation matrix about the Z axis.
- [`shz_xmtrx_rotate_xyz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_xyz/): `void shz_xmtrx_rotate_xyz(float xRadians, float yRadians, float zRadians)` Multiplies and accumulates XMTRX by 3D rotation matrices about the X then Y then Z axes.
- [`shz_xmtrx_rotate_zyx`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_zyx/): `void shz_xmtrx_rotate_zyx(float zRadians, float yRadians, float xRadians)` Multiplies and accumulates XMTRX by 3D rotation matrices about the Z then Y then X axes.
- [`shz_xmtrx_rotate_zxy`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_zxy/): `void shz_xmtrx_rotate_zxy(float zRadians, float xRadians, float yRadians)` Multiplies and accumulates XMTRX by 3D rotation matrices about the Z then X then Y axes.
- [`shz_xmtrx_rotate_yxz`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate_yxz/): `void shz_xmtrx_rotate_yxz(float yRadians, float xRadians, float zRadians)` Multiplies and accumulates XMTRX by 3D rotation matrices about the Y then X then Z axes.
- [`shz_xmtrx_rotate`](https://sh4zam.com/api/xmtrx/shz_xmtrx_rotate/): `void shz_xmtrx_rotate(float radians, float xAxis, float yAxis, float zAxis)` Multiplies and accumulates XMTRX by the 3D rotation matrix formed by the given axis and angle (glRotatef equivalent).

### XMTRX: Reverse GL Transformations

- [`shz_xmtrx_translate_reverse`](https://sh4zam.com/api/xmtrx/shz_xmtrx_translate_reverse/): `void shz_xmtrx_translate_reverse(float x, float y, float z)` Pre-multiplies and accumulates XMTRX onto the 3D translation matrix with the given components.
- [`shz_xmtrx_scale_reverse`](https://sh4zam.com/api/xmtrx/shz_xmtrx_scale_reverse/): `void shz_xmtrx_scale_reverse(float x, float y, float z)` Pre-multiplies and accumulates XMTRX onto the 3D scaling matrix with the given components.

### XMTRX: Compound Operations

- [`shz_xmtrx_load_apply_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_4x4/): `void shz_xmtrx_load_apply_4x4(const shz_mat4x4_t* matrix1, const shz_mat4x4_t* matrix2)` Loads XMTRX with the result of applying `matrix2` onto `matrix1`.
- [`shz_xmtrx_load_apply_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_unaligned_4x4/): `void shz_xmtrx_load_apply_unaligned_4x4(const float matrix1[16], const float matrix2[16])` Loads XMTRX with the result of applying unaligned `matrix2` onto `matrix1`.
- [`shz_xmtrx_apply_store_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_store_4x4/): `void shz_xmtrx_apply_store_4x4(shz_mat4x4_t* out, const shz_mat4x4_t* in)` Multiplies XMTRX by the matrix, `in`, storing the result within the matrix, `out`.
- [`shz_xmtrx_apply_store_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_apply_store_unaligned_4x4/): `void shz_xmtrx_apply_store_unaligned_4x4(float out[16], const float in[16])` Multiplies XMTRX by the unaligned matrix, `in`, storing the result within the unaligned matrix, `out`.
- [`shz_xmtrx_load_apply_store_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_store_4x4/): `void shz_xmtrx_load_apply_store_4x4(shz_mat4x4_t* out, const shz_mat4x4_t* matrix1, const shz_mat4x4_t* matrix2)` Loads XMTRX with the 4x4 result of applying `matrix2` onto `matrix1`, storing the result.
- [`shz_xmtrx_load_apply_store_unaligned_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_store_unaligned_4x4/): `void shz_xmtrx_load_apply_store_unaligned_4x4(float out[16], const float matrix1[16], const float matrix2[16])` Loads XMTRX with the result of applying unaligned `matrix2` onto unaligned `matrix1`, storing the result.
- [`shz_xmtrx_load_apply_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_3x4/): `void shz_xmtrx_load_apply_3x4(const shz_mat3x4_t* matrix1, const shz_mat3x4_t* matrix2)` Loads XMTRX with the result of applying `matrix2` onto `matrix1`.
- [`shz_xmtrx_load_apply_store_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_store_3x4/): `void shz_xmtrx_load_apply_store_3x4(shz_mat3x4_t* out, const shz_mat3x4_t* matrix1, const shz_mat3x4_t* matrix2)` Loads XMTRX with the 3x4 result of applying `matrix2` onto `matrix1`, storing the result.
- [`shz_xmtrx_load_apply_store_3x3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_load_apply_store_3x3/): `void shz_xmtrx_load_apply_store_3x3(shz_mat3x3_t* out, const shz_mat3x3_t* matrix1, const shz_mat3x3_t* matrix2)` Loads XMTRX with the 3x3 result of applying `matrix2` onto `matrix1`, storing the result.

### XMTRX: Transformations

- [`shz_xmtrx_transform_vec4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transform_vec4/): `shz_vec4_t shz_xmtrx_transform_vec4(shz_vec4_t vec)` Returns the 4D vector that is the result of transforming `vec` by XMTRX.
- [`shz_xmtrx_transform_vec3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transform_vec3/): `shz_vec3_t shz_xmtrx_transform_vec3(shz_vec3_t vec)` Returns the 3D vector that is the result of transforming `vec` by XMTRX.
- [`shz_xmtrx_transform_vec2`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transform_vec2/): `shz_vec2_t shz_xmtrx_transform_vec2(shz_vec2_t vec)` Returns the 2D vector that is the result of transforming `vec` by XMTRX.
- [`shz_xmtrx_transform_point2`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transform_point2/): `shz_vec2_t shz_xmtrx_transform_point2(shz_vec2_t pt)` Returns the 2D point that is the result of transforming `pt` by XMTRX.
- [`shz_xmtrx_transform_point3`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transform_point3/): `shz_vec3_t shz_xmtrx_transform_point3(shz_vec3_t pt)` Returns the 3D point that is the result of transforming `pt` by XMTRX.

### XMTRX: Setters

- [`shz_xmtrx_set_translation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_set_translation/): `void shz_xmtrx_set_translation(float x, float y, float z)` Sets only the translational components of XMTRX to the given values.
- [`shz_xmtrx_set_scale`](https://sh4zam.com/api/xmtrx/shz_xmtrx_set_scale/): `void shz_xmtrx_set_scale(float x, float y, float z)` Sets only the inner 3x3 submatrix of XMTRX to be a scaling matrix.

### XMTRX: Getters

- [`shz_xmtrx_get_translation`](https://sh4zam.com/api/xmtrx/shz_xmtrx_get_translation/): `shz_vec3_t shz_xmtrx_get_translation(void)` Returns the translational components from the last column of XMTRX, as a 3D vector.
- [`shz_xmtrx_get_scale`](https://sh4zam.com/api/xmtrx/shz_xmtrx_get_scale/): `shz_vec3_t shz_xmtrx_get_scale(void)` Returns the scaling components from the inner 3x3 matrix of XMTRX, as a 3D vector.

### XMTRX: Component-Wise Matrix Operations

- [`shz_xmtrx_add_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_add_4x4/): `void shz_xmtrx_add_4x4(const shz_mat4x4_t* mat)` Adds each element within `mat` to each element within XMTRX, storing the result in XMTRX.
- [`shz_xmtrx_sub_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_sub_4x4/): `void shz_xmtrx_sub_4x4(const shz_mat4x4_t* mat)` Subtracts each element within `mat` from each element within XMTRX, storing the result in XMTRX.

### XMTRX: Miscellaneous

- [`shz_xmtrx_transpose`](https://sh4zam.com/api/xmtrx/shz_xmtrx_transpose/): `void shz_xmtrx_transpose(void)` Transposes the elements within XMTRX, in-place.
- [`shz_xmtrx_negate`](https://sh4zam.com/api/xmtrx/shz_xmtrx_negate/): `void shz_xmtrx_negate(void)` Negates each element held within XMTRX.
- [`shz_xmtrx_abs`](https://sh4zam.com/api/xmtrx/shz_xmtrx_abs/): `void shz_xmtrx_abs(void)` Takes the absolute value of each element held within XMTRX.
- [`shz_xmtrx_to_quat`](https://sh4zam.com/api/xmtrx/shz_xmtrx_to_quat/): `shz_quat_t shz_xmtrx_to_quat(void)` Constructs a quaternion from the 3D rotation matrix within XMTRX.
- [`shz_xmtrx_determinant`](https://sh4zam.com/api/xmtrx/shz_xmtrx_determinant/): `float shz_xmtrx_determinant(void)` Returns the determinant of XMTRX.
- [`shz_xmtrx_invert`](https://sh4zam.com/api/xmtrx/shz_xmtrx_invert/): `void shz_xmtrx_invert(void)` Inverts XMTRX in-place.
- [`shz_xmtrx_blend`](https://sh4zam.com/api/xmtrx/shz_xmtrx_blend/): `void shz_xmtrx_blend(const shz_mat4x4_t* matrix, float weight)` Deprecated way to add and accumulate a scaled 4x4 matrix onto XMTRX.
- [`shz_xmtrx_blend_4x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_blend_4x4/): `void shz_xmtrx_blend_4x4(const shz_mat4x4_t* matrix, float weight)` Adds and accumulates a scaled 4x4 matrix onto XMTRX.
- [`shz_xmtrx_blend_3x4`](https://sh4zam.com/api/xmtrx/shz_xmtrx_blend_3x4/): `void shz_xmtrx_blend_3x4(const shz_mat3x4_t* matrix, float weight)` Adds and accumulates a scaled 3x4 matrix onto XMTRX.

### XMTRX: Enumerations

- [`shz_xmtrx_reg`](https://sh4zam.com/api/xmtrx/shz_xmtrx_reg/): `enum shz_xmtrx_reg` Registers comprising XMTRX, in the FPU back-bank.

## Complex

`#include <sh4zam/shz_complex.h>` · [module page](https://sh4zam.com/api/complex/)

### Complex: Preprocessor

- [`SHZ_CMPLXF`](https://sh4zam.com/api/complex/SHZ_CMPLXF/): `#define SHZ_CMPLXF(x, y) shz_cinitf(x, y)` Initializes a complex number.
- [`SHZ_CMPLXF32`](https://sh4zam.com/api/complex/SHZ_CMPLXF32/): `#define SHZ_CMPLXF32(x, y) SHZ_CMPLXF(x, y)` Initializes a complex number.
- [`SHZ_I`](https://sh4zam.com/api/complex/SHZ_I/): `#define SHZ_I SHZ_CMPLXF32(0.0f, 1.0f)` Unit imaginary constant, 'I'.

### Complex: Basic

- [`shz_cinitf`](https://sh4zam.com/api/complex/shz_cinitf/): `shz_complex_t shz_cinitf(float real, float imag)` Returns a complex number which has been initialized to contain the given component values.
- [`shz_cpolarf`](https://sh4zam.com/api/complex/shz_cpolarf/): `shz_complex_t shz_cpolarf(float r, float theta)` Returns a complex number with a magnitude of `r`, and a phase angle of `theta` (in radians).
- [`shz_cequalf`](https://sh4zam.com/api/complex/shz_cequalf/): `bool shz_cequalf(shz_complex_t lhs, shz_complex_t rhs)` Checks for equality between two complex numbers with either an absolute or relative tolerance.
- [`shz_crealf`](https://sh4zam.com/api/complex/shz_crealf/): `float shz_crealf(shz_complex_t c)` Returns the real component of a complex number.
- [`shz_cimagf`](https://sh4zam.com/api/complex/shz_cimagf/): `float shz_cimagf(shz_complex_t c)` Returns the imaginary component of a complex number.

### Complex: Arithmetic

- [`shz_caddf`](https://sh4zam.com/api/complex/shz_caddf/): `shz_complex_t shz_caddf(shz_complex_t lhs, shz_complex_t rhs)` Adds two complex numbers together and returns the result.
- [`shz_csubf`](https://sh4zam.com/api/complex/shz_csubf/): `shz_complex_t shz_csubf(shz_complex_t lhs, shz_complex_t rhs)` Subtracts `rhs` from `lhs` and returns the complex result.
- [`shz_cmulf`](https://sh4zam.com/api/complex/shz_cmulf/): `shz_complex_t shz_cmulf(shz_complex_t lhs, shz_complex_t rhs)` Multiplies two complex numbers together, returning the complex result.
- [`shz_cdivf`](https://sh4zam.com/api/complex/shz_cdivf/): `shz_complex_t shz_cdivf(shz_complex_t lhs, shz_complex_t rhs)` Divides `lhs` by `rhs`, returning the complex result.
- [`shz_cscalef`](https://sh4zam.com/api/complex/shz_cscalef/): `shz_complex_t shz_cscalef(shz_complex_t c, float v)` Scales both componets of the complex number, `c`, by the value, `v`, returning the result.
- [`shz_crecipf`](https://sh4zam.com/api/complex/shz_crecipf/): `shz_complex_t shz_crecipf(shz_complex_t c)` Returns the multiplicative inverse or reciprocal of the complex number, `c`.

### Complex: Manipulation

- [`shz_cabsf`](https://sh4zam.com/api/complex/shz_cabsf/): `float shz_cabsf(shz_complex_t c)` Returns the absolute value (or magnitude) of the complex number, `c`.
- [`shz_inv_cabsf`](https://sh4zam.com/api/complex/shz_inv_cabsf/): `float shz_inv_cabsf(shz_complex_t c)` Returns the inverse of the absolute value (or inverse of the magnitude) of the complex number, `c`.
- [`shz_cnormf`](https://sh4zam.com/api/complex/shz_cnormf/): `float shz_cnormf(shz_complex_t c)` Returns the squared magnitude of the complex number, `c`.
- [`shz_cargf`](https://sh4zam.com/api/complex/shz_cargf/): `float shz_cargf(shz_complex_t c)` Returns the phase angle of the complex number, `c`.
- [`shz_conjf`](https://sh4zam.com/api/complex/shz_conjf/): `shz_complex_t shz_conjf(shz_complex_t c)` Returns the complex conjugate of `c`.
- [`shz_cprojf`](https://sh4zam.com/api/complex/shz_cprojf/): `shz_complex_t shz_cprojf(shz_complex_t c)` Calculates the projection of the complex number, `c`, onto the Riemann sphere.

### Complex: Transcendental

- [`shz_csqrtf`](https://sh4zam.com/api/complex/shz_csqrtf/): `shz_complex_t shz_csqrtf(shz_complex_t c)` Computes and returns the complex square root of `c`.
- [`shz_cpowf`](https://sh4zam.com/api/complex/shz_cpowf/): `shz_complex_t shz_cpowf(shz_complex_t base, shz_complex_t exp)` Raises the complex `base` to the complex `exp` power, returning a complex result.
- [`shz_cexpf`](https://sh4zam.com/api/complex/shz_cexpf/): `shz_complex_t shz_cexpf(shz_complex_t c)` Returns the complex base `e` exponential of `c`.
- [`shz_clogf`](https://sh4zam.com/api/complex/shz_clogf/): `shz_complex_t shz_clogf(shz_complex_t c)` Computes and returns the complex natural logarithm of `c`.
- [`shz_clog10f`](https://sh4zam.com/api/complex/shz_clog10f/): `shz_complex_t shz_clog10f(shz_complex_t c)` Computes and returns the complex base 10 logarithm of `c`.

### Complex: Spherical Trigonometry

- [`shz_csinf`](https://sh4zam.com/api/complex/shz_csinf/): `shz_complex_t shz_csinf(shz_complex_t c)` Calculates and returns the complex sine of `c`.
- [`shz_ccosf`](https://sh4zam.com/api/complex/shz_ccosf/): `shz_complex_t shz_ccosf(shz_complex_t c)` Calculates and returns the complex cosine of `c`.
- [`shz_ctanf`](https://sh4zam.com/api/complex/shz_ctanf/): `shz_complex_t shz_ctanf(shz_complex_t c)` Calculates and returns the complex tangent of `c`.
- [`shz_ccscf`](https://sh4zam.com/api/complex/shz_ccscf/): `shz_complex_t shz_ccscf(shz_complex_t c)` Calculates and returns the complex cosecant of `c`.
- [`shz_csecf`](https://sh4zam.com/api/complex/shz_csecf/): `shz_complex_t shz_csecf(shz_complex_t c)` Calculates and returns the complex secant of `c`.
- [`shz_ccotf`](https://sh4zam.com/api/complex/shz_ccotf/): `shz_complex_t shz_ccotf(shz_complex_t c)` Calculates and returns the complex cotangent of `c`.
- [`shz_casinf`](https://sh4zam.com/api/complex/shz_casinf/): `shz_complex_t shz_casinf(shz_complex_t c)` Calculates and returns the complex arcsine of `c`.
- [`shz_cacosf`](https://sh4zam.com/api/complex/shz_cacosf/): `shz_complex_t shz_cacosf(shz_complex_t c)` Calculates and returns the complex arccosine of `c`.
- [`shz_catanf`](https://sh4zam.com/api/complex/shz_catanf/): `shz_complex_t shz_catanf(shz_complex_t c)` Calculates and returns the complex arctangent of `c`.
- [`shz_cacscf`](https://sh4zam.com/api/complex/shz_cacscf/): `shz_complex_t shz_cacscf(shz_complex_t c)` Calculates and returns the complex arccosecant of `c`.
- [`shz_casecf`](https://sh4zam.com/api/complex/shz_casecf/): `shz_complex_t shz_casecf(shz_complex_t c)` Calculates and returns the complex arcsecant of `c`.
- [`shz_cacotf`](https://sh4zam.com/api/complex/shz_cacotf/): `shz_complex_t shz_cacotf(shz_complex_t c)` Calculates and returns the complex arccotangent of `c`.

### Complex: Hyperbolic Trigonometry

- [`shz_csinhf`](https://sh4zam.com/api/complex/shz_csinhf/): `shz_complex_t shz_csinhf(shz_complex_t c)` Calculates and returns the complex hyperbolic sine of `c`.
- [`shz_ccoshf`](https://sh4zam.com/api/complex/shz_ccoshf/): `shz_complex_t shz_ccoshf(shz_complex_t c)` Calculates and returns the complex hyperbolic cosine of `c`.
- [`shz_ctanhf`](https://sh4zam.com/api/complex/shz_ctanhf/): `shz_complex_t shz_ctanhf(shz_complex_t c)` Calculates and returns the complex hyperbolic tangent of `c`.
- [`shz_ccschf`](https://sh4zam.com/api/complex/shz_ccschf/): `shz_complex_t shz_ccschf(shz_complex_t c)` Calculates and returns the complex hyperbolic cosecant of `c`.
- [`shz_csechf`](https://sh4zam.com/api/complex/shz_csechf/): `shz_complex_t shz_csechf(shz_complex_t c)` Calculates and returns the complex hyperbolic secant of `c`.
- [`shz_ccothf`](https://sh4zam.com/api/complex/shz_ccothf/): `shz_complex_t shz_ccothf(shz_complex_t c)` Calculates and returns the complex hyperbolic cotangent of `c`.
- [`shz_casinhf`](https://sh4zam.com/api/complex/shz_casinhf/): `shz_complex_t shz_casinhf(shz_complex_t c)` Calculates and returns the complex hyperbolic arcsine of `c`.
- [`shz_cacoshf`](https://sh4zam.com/api/complex/shz_cacoshf/): `shz_complex_t shz_cacoshf(shz_complex_t c)` Calculates and returns the complex hyperbolic arccosine of `c`.
- [`shz_catanhf`](https://sh4zam.com/api/complex/shz_catanhf/): `shz_complex_t shz_catanhf(shz_complex_t c)` Calculates and returns the complex hyperbolic arctangent of `c`.
- [`shz_cacschf`](https://sh4zam.com/api/complex/shz_cacschf/): `shz_complex_t shz_cacschf(shz_complex_t c)` Calculates and returns the complex hyperbolic arccosecant of `c`.
- [`shz_casechf`](https://sh4zam.com/api/complex/shz_casechf/): `shz_complex_t shz_casechf(shz_complex_t c)` Calculates and returns the complex hyperbolic arcsecant of `c`.
- [`shz_cacothf`](https://sh4zam.com/api/complex/shz_cacothf/): `shz_complex_t shz_cacothf(shz_complex_t c)` Calculates and returns the complex hyperbolic arccotangent of `c`.

### Complex: Signal Processing

- [`shz_fft`](https://sh4zam.com/api/complex/shz_fft/): `void shz_fft(shz_complex_t* s, size_t size)` Fast Fourier Transform.

### Complex: Types

- [`shz_complex_t`](https://sh4zam.com/api/complex/shz_complex_t/): `struct shz_complex_t` Represents a floating-point complex number real/imaginary pair.
- [`shz_complex`](https://sh4zam.com/api/complex/shz_complex/): `typedef shz_complex_t shz_complex` `shz_complex_t` alias for those who don't like POSIX-style.

## Memory

`#include <sh4zam/shz_mem.h>` · [module page](https://sh4zam.com/api/memory/)

### Memory: C stdlib Replacements

- [`shz_memcpy`](https://sh4zam.com/api/memory/shz_memcpy/): `void* shz_memcpy( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Generic drop-in fast memcpy() replacement.
- [`shz_memmove`](https://sh4zam.com/api/memory/shz_memmove/): `void* shz_memmove(void* dst, const void* src, size_t bytes)` Generic drop-in fast memmove() replacement.

### Memory: Specializations

- [`shz_memcpy1`](https://sh4zam.com/api/memory/shz_memcpy1/): `void* shz_memcpy1( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies an unaligned buffer to another one byte at a time.
- [`shz_memcpy2`](https://sh4zam.com/api/memory/shz_memcpy2/): `void* shz_memcpy2( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies from one 2-byte aligned buffer to another two bytes at a time.
- [`shz_memcpy4`](https://sh4zam.com/api/memory/shz_memcpy4/): `void* shz_memcpy4( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies a from one 4-byte aligned buffer to another 4 bytes at a time.
- [`shz_memcpy8`](https://sh4zam.com/api/memory/shz_memcpy8/): `void* shz_memcpy8( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies a from one 8-byte aligned buffer to another 8 bytes at a time.
- [`shz_memset8`](https://sh4zam.com/api/memory/shz_memset8/): `void* shz_memset8(void* dst, uint64_t value, size_t bytes)` Assigns the given 8-byte `value` to the `bytes` in `dst`.
- [`shz_memcpy32`](https://sh4zam.com/api/memory/shz_memcpy32/): `void* shz_memcpy32( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies `bytes` from the `src` to the `dst` buffer in 32-byte chunks.
- [`shz_sq_memcpy32`](https://sh4zam.com/api/memory/shz_sq_memcpy32/): `void* shz_sq_memcpy32( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies `bytes` from `src` to `dst` in 32-byte chunks, using the Store Queues.
- [`shz_sq_memcpy32_xmtrx`](https://sh4zam.com/api/memory/shz_sq_memcpy32_xmtrx/): `void* shz_sq_memcpy32_xmtrx( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Copies `bytes` from `src` to `dst` in 32-byte chunks, using the Store Queues and XMTRX.
- [`shz_memcpy64`](https://sh4zam.com/api/memory/shz_memcpy64/): `void* shz_memcpy64( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Specialized memcpy() variant for copying multiples of 64-bytes.
- [`shz_memcpy128`](https://sh4zam.com/api/memory/shz_memcpy128/): `void* shz_memcpy128( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src, size_t bytes)` Specialized memcpy() variant for copying multiples of 128 bytes.

### Memory: Constant-sized Operations

- [`shz_memcpy2_8`](https://sh4zam.com/api/memory/shz_memcpy2_8/): `void shz_memcpy2_8( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies 8 shorts from `src` to `dst`.
- [`shz_memcpy2_16`](https://sh4zam.com/api/memory/shz_memcpy2_16/): `void shz_memcpy2_16( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies 16 shorts from `src` to `dst`.
- [`shz_memset2_16`](https://sh4zam.com/api/memory/shz_memset2_16/): `void shz_memset2_16(void* dst, uint16_t value)` Sets the values of the 16 shorts pointed to by `dst` to the given `value`.
- [`shz_memcpy4_16`](https://sh4zam.com/api/memory/shz_memcpy4_16/): `void shz_memcpy4_16( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies 16 4-byte, long values from `src` to `dst`.
- [`shz_memcpy32_1`](https://sh4zam.com/api/memory/shz_memcpy32_1/): `void shz_memcpy32_1( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies 32 bytes from `p1` to `p2` as a single chunk.
- [`shz_memswap32_1`](https://sh4zam.com/api/memory/shz_memswap32_1/): `void shz_memswap32_1(void* SHZ_RESTRICT p1, void* SHZ_RESTRICT p2)` Swaps the values within the given 32-byte buffers.
- [`shz_memswap32_1_xmtrx`](https://sh4zam.com/api/memory/shz_memswap32_1_xmtrx/): `void shz_memswap32_1_xmtrx(void* SHZ_RESTRICT p1, void* SHZ_RESTRICT p2)` Swaps the values within the given 32-byte buffers, using XMTRX.
- [`shz_sq_memcpy32_1`](https://sh4zam.com/api/memory/shz_sq_memcpy32_1/): `void* shz_sq_memcpy32_1( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies `src` to `dst` in a single 32-byte transaction using the Store Queues.
- [`shz_sq_memcpy32_1_xmtrx`](https://sh4zam.com/api/memory/shz_sq_memcpy32_1_xmtrx/): `void* shz_sq_memcpy32_1_xmtrx( void* SHZ_RESTRICT dst, const void* SHZ_RESTRICT src)` Copies `src` to `dst` in a single 32-byte transaction using the Store Queues and XMTRX.
- [`shz_dcache_alloc_line`](https://sh4zam.com/api/memory/shz_dcache_alloc_line/): `void shz_dcache_alloc_line(void* src)` Intrinsic around the SH4 `MOVCA.L` instruction.

### Memory: Macros

- [`SHZ_PREFETCH`](https://sh4zam.com/api/memory/SHZ_PREFETCH/): `#define SHZ_PREFETCH(ptr) SHZ_PREFETCH_(ptr)` Used to prepopulate the cache line mapping to the given address, before it is used.

## Compiler Definitions

`#include <sh4zam/shz_cdefs.h>` · [module page](https://sh4zam.com/api/cdefs/)

### Compiler Definitions: Back-Ends

- [`SHZ_SH4`](https://sh4zam.com/api/cdefs/SHZ_SH4/): `#define SHZ_SH4 1` Back-end for the Dreamcast's SH4.
- [`SHZ_PPC`](https://sh4zam.com/api/cdefs/SHZ_PPC/): `#define SHZ_PPC 2` Back-end for the Gamecube/Wii's Gekko PPC.
- [`SHZ_MIPS`](https://sh4zam.com/api/cdefs/SHZ_MIPS/): `#define SHZ_MIPS 3` Back-end for MIPS architectures.
- [`SHZ_ARM`](https://sh4zam.com/api/cdefs/SHZ_ARM/): `#define SHZ_ARM 4` Back-end for ARM architectures.
- [`SHZ_X86_64`](https://sh4zam.com/api/cdefs/SHZ_X86_64/): `#define SHZ_X86_64 5` Back-end for x86_64 architectures.
- [`SHZ_SPU`](https://sh4zam.com/api/cdefs/SHZ_SPU/): `#define SHZ_SPU 6` Back-end for the Cell B/E SPU architecture.
- [`SHZ_WASM`](https://sh4zam.com/api/cdefs/SHZ_WASM/): `#define SHZ_WASM 8` Back-end for WebAssembly.
- [`SHZ_SW`](https://sh4zam.com/api/cdefs/SHZ_SW/): `#define SHZ_SW ~0` Generic C-based software back-end.

### Compiler Definitions: TLS Models

- [`SHZ_TLS_DISABLED`](https://sh4zam.com/api/cdefs/SHZ_TLS_DISABLED/): `#define SHZ_TLS_DISABLED 0` No thread-local variables.
- [`SHZ_TLS_IMPLICIT`](https://sh4zam.com/api/cdefs/SHZ_TLS_IMPLICIT/): `#define SHZ_TLS_IMPLICIT 1` Use `thread_local` keyword for TLS.
- [`SHZ_TLS_PTHREAD`](https://sh4zam.com/api/cdefs/SHZ_TLS_PTHREAD/): `#define SHZ_TLS_PTHREAD 2` Use pthread unique keys for TLS.
- [`SHZ_TLS_CTHREAD`](https://sh4zam.com/api/cdefs/SHZ_TLS_CTHREAD/): `#define SHZ_TLS_CTHREAD 3` Use C11 thread TSS keys for TLS.

### Compiler Definitions: Compiler Detection

- [`SHZ_GNUC`](https://sh4zam.com/api/cdefs/SHZ_GNUC/): `#define SHZ_GNUC 1` Defined when building with a GCC-compatible compiler.

### Compiler Definitions: Utilities

- [`SHZ_STRINGIFY_LITERAL`](https://sh4zam.com/api/cdefs/SHZ_STRINGIFY_LITERAL/): `#define SHZ_STRINGIFY_LITERAL(a) #a` Stringifies a literal expression.
- [`SHZ_STRINGIFY`](https://sh4zam.com/api/cdefs/SHZ_STRINGIFY/): `#define SHZ_STRINGIFY(a) SHZ_STRINGIFY_LITERAL(a)` Stringifies an expression *after* preprocessing, supporting macro expansion.
- [`SHZ_COUNT_OF`](https://sh4zam.com/api/cdefs/SHZ_COUNT_OF/): `#define SHZ_COUNT_OF(array) (sizeof(array) / sizeof((array)[0]))` Returns the number of elements within a statically sized array.
- [`SHZ_CONTAINER_OF`](https://sh4zam.com/api/cdefs/SHZ_CONTAINER_OF/): `#define SHZ_CONTAINER_OF(ptr, type, member) ((type*)((char*)(ptr) - offsetof(type, member)))` Returns the containing structure from a pointer to one of its members.
- [`SHZ_SWAP`](https://sh4zam.com/api/cdefs/SHZ_SWAP/): `#define SHZ_SWAP(a, b) do { typeof(a) tmp = a; a = b; b = tmp; } while(false)` Macro which swaps the two values held by `a` and `b`.
- [`SHZ_DECLARE_STRUCT`](https://sh4zam.com/api/cdefs/SHZ_DECLARE_STRUCT/): `#define SHZ_DECLARE_STRUCT(n, t) struct n; typedef struct n t` Macro which forward declares a struct and its typedef.
- [`SHZ_DECLARE_STRUCT_ALIGNED`](https://sh4zam.com/api/cdefs/SHZ_DECLARE_STRUCT_ALIGNED/): `#define SHZ_DECLARE_STRUCT_ALIGNED(n, t, a) struct SHZ_ALIGNAS(a) n; typedef struct n t` Macro which forward declares a manually aligned struct and its typedef.

### Compiler Definitions: TLS Utilities

- [`SHZ_TLS_DECL`](https://sh4zam.com/api/cdefs/SHZ_TLS_DECL/): `#define SHZ_TLS_DECL(type, name, ...) static type name = __VA_ARGS__` Declares a TLS variable with disabled model (so not thread-local).
- [`SHZ_TLS_REF`](https://sh4zam.com/api/cdefs/SHZ_TLS_REF/): `#define SHZ_TLS_REF(name) (&name)` References a TLS variable, with disabled model.

### Compiler Definitions: Aliasing Types

- [`shz_alias_int16_t`](https://sh4zam.com/api/cdefs/shz_alias_int16_t/): `typedef SHZ_ALIASING int16_t shz_alias_int16_t` int16_t type whose value may be aliased as another type.
- [`shz_alias_uint16_t`](https://sh4zam.com/api/cdefs/shz_alias_uint16_t/): `typedef SHZ_ALIASING uint16_t shz_alias_uint16_t` uint16_t type whose value may be aliased as another type.
- [`shz_alias_int32_t`](https://sh4zam.com/api/cdefs/shz_alias_int32_t/): `typedef SHZ_ALIASING int32_t shz_alias_int32_t` int32_t type whose value may be aliased as another type.
- [`shz_alias_uint32_t`](https://sh4zam.com/api/cdefs/shz_alias_uint32_t/): `typedef SHZ_ALIASING uint32_t shz_alias_uint32_t` uint32_t type whose value may be aliased as another type.
- [`shz_alias_float_t`](https://sh4zam.com/api/cdefs/shz_alias_float_t/): `typedef SHZ_ALIASING float shz_alias_float_t` float type whose value may be aliased as another type.
- [`shz_alias_int64_t`](https://sh4zam.com/api/cdefs/shz_alias_int64_t/): `typedef SHZ_ALIASING int64_t shz_alias_int64_t` int64_t type whose value may be aliased as another type.
- [`shz_alias_uint64_t`](https://sh4zam.com/api/cdefs/shz_alias_uint64_t/): `typedef SHZ_ALIASING uint64_t shz_alias_uint64_t` uint64_t type whose value may be aliased as another type.
- [`shz_alias_double_t`](https://sh4zam.com/api/cdefs/shz_alias_double_t/): `typedef SHZ_ALIASING double shz_alias_double_t` double type whose value may be aliased as another type.

### Compiler Definitions: Macros

- [`SHZ_TARGET`](https://sh4zam.com/api/cdefs/SHZ_TARGET/): `#define SHZ_TARGET SHZ_SW` Target architecture Determines the actual architecture we're building for.
- [`SHZ_BACKEND`](https://sh4zam.com/api/cdefs/SHZ_BACKEND/): `#define SHZ_BACKEND SHZ_SPU` SH4ZAM back-end Selects which SH4ZAM implementation to use for a given target.
- [`SHZ_TLS_MODEL`](https://sh4zam.com/api/cdefs/SHZ_TLS_MODEL/): `#define SHZ_TLS_MODEL SHZ_TLS_IMPLICIT` thread_local storage.

### Compiler Definitions: Not in upstream reference

- [`SHZ_MSVC`](https://sh4zam.com/api/cdefs/SHZ_MSVC/): `#define SHZ_MSVC 1` Defined when building with Microsoft Visual C++.
- [`SHZ_CLANG`](https://sh4zam.com/api/cdefs/SHZ_CLANG/): `#define SHZ_CLANG 1` Defined when bulding with Clang.
- [`SHZ_MINGW64`](https://sh4zam.com/api/cdefs/SHZ_MINGW64/): `#define SHZ_MINGW64 1` Defined when bulding with MinGW-w64.
- [`SHZ_MINGW32`](https://sh4zam.com/api/cdefs/SHZ_MINGW32/): `#define SHZ_MINGW32 1` Defined when building for 32-bit MinGW or other MinGW compiler(s).
- [`SHZ_GCC`](https://sh4zam.com/api/cdefs/SHZ_GCC/): `#define SHZ_GCC 1` Defined when building for GCC.
- [`SHZ_ALIGNAS`](https://sh4zam.com/api/cdefs/SHZ_ALIGNAS/): `#define SHZ_ALIGNAS(N) __attribute__((aligned((N))))` Forces a function or type to be aligned by `N` bytes.
- [`SHZ_SIMD`](https://sh4zam.com/api/cdefs/SHZ_SIMD/): `#define SHZ_SIMD(N) __attribute__((vector_size((N))))` Tells GCC that a scalar type is to be treated as a vector of size `N.`
- [`SHZ_HOT`](https://sh4zam.com/api/cdefs/SHZ_HOT/): `#define __attribute__((hot))` Tells GCC that a particular function should be optimized for performance.
- [`SHZ_COLD`](https://sh4zam.com/api/cdefs/SHZ_COLD/): `#define __attribute__((cold))` Tells GCC that a particular function should be optimized for size.
- [`SHZ_FAST_MATH`](https://sh4zam.com/api/cdefs/SHZ_FAST_MATH/): `#define __attribute__((optimize("fast-math")))` Put this before a function definition to tell GCC to use fast math optimizations on a specific function.
- [`SHZ_NO_FAST_MATH`](https://sh4zam.com/api/cdefs/SHZ_NO_FAST_MATH/): `#define SHZ_NO_FAST_MATH __attribute__((optimize("no-fast-math")))` Put this before a function definition to tell GCC to NOT use fast math optimizations on a specific function.
- [`SHZ_NO_UNROLL_LOOPS`](https://sh4zam.com/api/cdefs/SHZ_NO_UNROLL_LOOPS/): `#define SHZ_NO_UNROLL_LOOPS __attribute__((optimize("no-unroll-loops")))` Put this before a function definition to tell GCC to NOT unroll loops in a specific function.
- [`SHZ_NO_OPTIMIZATION`](https://sh4zam.com/api/cdefs/SHZ_NO_OPTIMIZATION/): `#define SHZ_NO_OPTIMIZATION __attribute__((optimize("O0")))` Tells GCC to disable any optimizations when compiling a function.
- [`SHZ_FUNC_ALIGNAS`](https://sh4zam.com/api/cdefs/SHZ_FUNC_ALIGNAS/): `#define SHZ_FUNC_ALIGNAS(N) __attribute__((aligned(N)))` Aligns a function within the .text segment by `N` bytes.
- [`SHZ_FORCE_INLINE`](https://sh4zam.com/api/cdefs/SHZ_FORCE_INLINE/): `#define __attribute__((always_inline))` Forces GCC to inline the given function.
- [`SHZ_NO_INLINE`](https://sh4zam.com/api/cdefs/SHZ_NO_INLINE/): `#define __attribute__((noinline))` Prevents GCC from inlining the given function.
- [`SHZ_FLATTEN`](https://sh4zam.com/api/cdefs/SHZ_FLATTEN/): `#define SHZ_FLATTEN __attribute__((flatten))` Forces GCC to inline all calls to other functions made within the tagged function.
- [`SHZ_PACKED`](https://sh4zam.com/api/cdefs/SHZ_PACKED/): `#define SHZ_PACKED __attribute__((packed))` Tells GCC not to introduce any extra padding for the given type.
- [`SHZ_PURE`](https://sh4zam.com/api/cdefs/SHZ_PURE/): `#define __attribute__((pure))` Tells GCC the function has no effects other than returning a value that depends on its arguments and global variables.
- [`SHZ_CONST`](https://sh4zam.com/api/cdefs/SHZ_CONST/): `#define __attribute__((const))` Tells GCC the function has no effects other than returning a value that depends only on its arguments.
- [`SHZ_ALIASING`](https://sh4zam.com/api/cdefs/SHZ_ALIASING/): `#define SHZ_ALIASING __attribute__((__may_alias__))` Tells GCC that the decorated pointer may be breaking strict aliasing rules for C and C++
- [`SHZ_DEPRECATED`](https://sh4zam.com/api/cdefs/SHZ_DEPRECATED/): `#define SHZ_DEPRECATED(m) __attribute__((deprecated(m)))` Emits a warning that a symbol has been deprecated with a message, upon use.
- [`SHZ_LIKELY`](https://sh4zam.com/api/cdefs/SHZ_LIKELY/): `#define SHZ_LIKELY(e) __builtin_expect(!!(e), 1)` Tells GCC that the expression is likely to be true (used for conditional and loop optimizations)
- [`SHZ_UNLIKELY`](https://sh4zam.com/api/cdefs/SHZ_UNLIKELY/): `#define SHZ_UNLIKELY(e) __builtin_expect(!!(e), 0)` Tells GCC that the expression is likely to be false (used for conditional and loop optimizations)
- [`SHZ_RESTRICT`](https://sh4zam.com/api/cdefs/SHZ_RESTRICT/): `#define SHZ_RESTRICT __restrict__` Tells GCC the pointer paraemter is unique and is not aliased by another parameter
- [`SHZ_MEMORY_BARRIER_SOFT`](https://sh4zam.com/api/cdefs/SHZ_MEMORY_BARRIER_SOFT/): `#define SHZ_MEMORY_BARRIER_SOFT() asm volatile("" : : : "memory")` Creates a software memory barrier beyond which any loads or stores may not be reordered
- [`SHZ_MEMORY_BARRIER_HARD`](https://sh4zam.com/api/cdefs/SHZ_MEMORY_BARRIER_HARD/): `#define SHZ_MEMORY_BARRIER_HARD() __sync_synchronize()` Creates a hardware memory barrier beyond which any loads or stores may not be reordered
- [`SHZ_INSTR_BARRIER`](https://sh4zam.com/api/cdefs/SHZ_INSTR_BARRIER/): `#define SHZ_INSTR_BARRIER() asm volatile("")` Prevents the compiler from reordering instructions beyond the barrier.
- [`SHZ_DECLS_BEGIN`](https://sh4zam.com/api/cdefs/SHZ_DECLS_BEGIN/): `#define` Dummy define provided for C++ compatibility
- [`SHZ_DECLS_END`](https://sh4zam.com/api/cdefs/SHZ_DECLS_END/): `#define` Dummy define provided for C++ compatibility
- [`SHZ_INLINE`](https://sh4zam.com/api/cdefs/SHZ_INLINE/): `#define inline static` Requests a function or member to be inlined (nonforcibly) OR to have static linkage.
- [`SHZ_NOEXCEPT`](https://sh4zam.com/api/cdefs/SHZ_NOEXCEPT/): `#define` Dummy define provided for C++ compatibility
- [`SHZ_INIT`](https://sh4zam.com/api/cdefs/SHZ_INIT/): `#define SHZ_INIT(type, ...) ((type){ __VA_ARGS__ })` Temporary struct initialization statement to use within C.
- [`SHZ_CONVERT`](https://sh4zam.com/api/cdefs/SHZ_CONVERT/): `#define SHZ_CONVERT(type, value)` Conversion macro for zero-overhead conversions, taking the given `value` to a value of the given `type.`

## Version

`#include <sh4zam/shz_version.h>` · [module page](https://sh4zam.com/api/version/)

### Version: Compile-Time Utilities

- [`SHZ_VERSION_MAJOR`](https://sh4zam.com/api/version/SHZ_VERSION_MAJOR/): `#define SHZ_VERSION_MAJOR 0` Compile-time SH4ZAM major version.
- [`SHZ_VERSION_MINOR`](https://sh4zam.com/api/version/SHZ_VERSION_MINOR/): `#define SHZ_VERSION_MINOR 9` Compile-time SH4ZAM minor version.
- [`SHZ_VERSION_PATCH`](https://sh4zam.com/api/version/SHZ_VERSION_PATCH/): `#define SHZ_VERSION_PATCH 1` Compile-time Sh4ZAM patch version.
- [`SHZ_VERSION`](https://sh4zam.com/api/version/SHZ_VERSION/): `#define SHZ_VERSION` Current SH4ZAM full compile-time version identifier, integer-compatible.
- [`SHZ_VERSION_INIT`](https://sh4zam.com/api/version/SHZ_VERSION_INIT/): `#define SHZ_VERSION_INIT(major, minor, patch)` Packs values of individual version components into a SH4ZAM full version value.

### Version: Link-Time Utilities

- [`shz_version_t`](https://sh4zam.com/api/version/shz_version_t/): `typedef uint32_t shz_version_t` Integer-compatible value type containing a full SH4ZAM version.
- [`shz_version`](https://sh4zam.com/api/version/shz_version-typedef/): `typedef shz_version_t shz_version` Version typedef for those who hate POSIX-style.
- [`shz_version_linked`](https://sh4zam.com/api/version/shz_version_linked/): `shz_version_t shz_version_linked(void)` Returns the full version of SH4ZAM that was linked against.
- [`shz_version_fields`](https://sh4zam.com/api/version/shz_version_fields/): `void shz_version_fields(shz_version_t version, uint8_t* major, uint16_t* minor, uint8_t* patch)` Extracts the individual version component values from a full version.
