SH4ZAM! 0.1.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz_vector.h File Reference
#include <math.h>
#include <float.h>
#include "shz_scalar.h"
#include "shz_trig.h"
#include "inline/shz_vector.inl.h"
Include dependency graph for shz_vector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  shz_vec2_t
 
struct  shz_vec3_t
 
struct  shz_vec4_t
 

Macros

Adapters

Macros for converting between SH4ZAM and other compatible formats.

#define shz_vec2_deref(ptr)
 
#define shz_vec3_deref(ptr)
 
#define shz_vec4_deref(ptr)
 
#define shz_vec2_from(value)
 
#define shz_vec3_from(value)
 
#define shz_vec4_from(value)
 
#define shz_vec2_to(type, vector)
 
#define shz_vec3_to(type, vector)
 
#define shz_vec4_to(type, vector)
 
Type-Generic Routines

Generalized vector routines for C and C++.

#define shz_vec_abs(vec)
 
#define shz_vec_neg(vec)
 
#define shz_vec_inv(vec)
 
#define shz_vec_max(vec)
 
#define shz_vec_min(vec)
 
#define shz_vec_clamp(vec, min, max)
 
#define shz_vec_equal(vec1, vec2)
 
#define shz_vec_add(vec1, vec2)
 
#define shz_vec_sub(vec1, vec2)
 
#define shz_vec_mul(vec1, vec2)
 
#define shz_vec_div(vec1, vec2)
 
#define shz_vec_scale(vec, factor)
 
#define shz_vec_dot(vec1, vec2)
 
#define shz_vec_dot2(l, r1, r2)
 
#define shz_vec_dot3(l, r1, r2, r3)
 
#define shz_vec_magnitude_sqr(vec)
 
#define shz_vec_magnitude(vec)
 
#define shz_vec_magnitude_inv(vec)
 
#define shz_vec_normalize(vec)
 
#define shz_vec_normalize_safe(vec)
 
#define shz_vec_distance(vec1, vec2)
 
#define shz_vec_move(vec, target, maxdist)
 
#define shz_vec_distance_sqr(vec1, vec2)
 
#define shz_vec_lerp(vec1, vec2, t)
 
#define shz_vec_reflect(incidence, normal)
 
#define shz_vec_refract(incidence, normal, eta)
 
#define shz_vec_cross(vec1, vec2)
 
#define shz_vec_project(vec1, vec2)
 
#define shz_vec_project_safe(vec1, vec2)
 
#define shz_vec_angles(vec)
 
#define shz_vec_angle_between(vec1, vec2)
 
#define shz_vec_swizzle(vec, ...)
 
#define shz_vec_floor(vec)
 
#define shz_vec_ceil(vec)
 
#define shz_vec_round(vec)
 
#define shz_vec_fract(vec)
 
#define shz_vec_sign(vec)
 
#define shz_vec_saturate(vec)
 
#define shz_vec_minv(a, b)
 
#define shz_vec_maxv(a, b)
 
#define shz_vec_stepv(vec, edge)
 
#define shz_vec_step(vec, edge)
 
#define shz_vec_smoothstepv(vec, edge0, edge1)
 
#define shz_vec_smoothstep(vec, edge0, edge1)
 
#define shz_vec_smoothstepv_safe(vec, edge0, edge1)
 
#define shz_vec_smoothstep_safe(vec, edge0, edge1)
 

Typedefs

typedef shz_vec2_t shz_vec2
 
typedef shz_vec3_t shz_vec3
 
typedef shz_vec4_t shz_vec4
 

Functions

Initializers

Component-based initialization routines.

shz_vec2_t shz_vec2_init (float x, float y) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_init (float x, float y, float z) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_init (float x, float y, float z, float w) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_fill (float v) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_fill (float v) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_fill (float v) SHZ_NOEXCEPT
 
Component-wise Operations

Routines which apply to each vector component.

shz_vec2_t shz_vec2_abs (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_abs (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_abs (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_neg (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_neg (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_neg (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_inv (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_inv (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_inv (shz_vec4_t vec) SHZ_NOEXCEPT
 
float shz_vec2_max (shz_vec2_t vec) SHZ_NOEXCEPT
 
float shz_vec3_max (shz_vec3_t vec) SHZ_NOEXCEPT
 
float shz_vec4_max (shz_vec4_t vec) SHZ_NOEXCEPT
 
float shz_vec2_min (shz_vec2_t vec) SHZ_NOEXCEPT
 
float shz_vec3_min (shz_vec3_t vec) SHZ_NOEXCEPT
 
float shz_vec4_min (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_clamp (shz_vec2_t vec, float min, float max) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_clamp (shz_vec3_t vec, float min, float max) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_clamp (shz_vec4_t vec, float min, float max) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_floor (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_floor (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_floor (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_ceil (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_ceil (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_ceil (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_round (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_round (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_round (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_fract (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_fract (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_fract (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_sign (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_sign (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_sign (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_saturate (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_saturate (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_saturate (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_minv (shz_vec2_t a, shz_vec2_t b) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_minv (shz_vec3_t a, shz_vec3_t b) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_minv (shz_vec4_t a, shz_vec4_t b) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_maxv (shz_vec2_t a, shz_vec2_t b) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_maxv (shz_vec3_t a, shz_vec3_t b) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_maxv (shz_vec4_t a, shz_vec4_t b) SHZ_NOEXCEPT
 
bool shz_vec2_equal (shz_vec2_t a, shz_vec2_t b) SHZ_NOEXCEPT
 
bool shz_vec3_equal (shz_vec3_t a, shz_vec3_t b) SHZ_NOEXCEPT
 
bool shz_vec4_equal (shz_vec4_t a, shz_vec4_t b) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_stepv (shz_vec2_t vec, shz_vec2_t edge) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_stepv (shz_vec3_t vec, shz_vec3_t edge) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_stepv (shz_vec4_t vec, shz_vec4_t edge) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_step (shz_vec2_t vec, float edge) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_step (shz_vec3_t vec, float edge) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_step (shz_vec4_t vec, float edge) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_smoothstep (shz_vec2_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_smoothstep (shz_vec3_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_smoothstep (shz_vec4_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_smoothstepv (shz_vec2_t vec, shz_vec2_t edge0, shz_vec2_t edge1) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_smoothstepv (shz_vec3_t vec, shz_vec3_t edge0, shz_vec3_t edge1) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_smoothstepv (shz_vec4_t vec, shz_vec4_t edge0, shz_vec4_t edge1) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_smoothstep_safe (shz_vec2_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_smoothstep_safe (shz_vec3_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_smoothstep_safe (shz_vec4_t vec, float edge0, float edge1) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_smoothstepv_safe (shz_vec2_t vec, shz_vec2_t edge0, shz_vec2_t edge1) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_smoothstepv_safe (shz_vec3_t vec, shz_vec3_t edge0, shz_vec3_t edge1) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_smoothstepv_safe (shz_vec4_t vec, shz_vec4_t edge0, shz_vec4_t edge1) SHZ_NOEXCEPT
 
Arithmetic

Routines for basic vector arithmetic operations.

shz_vec2_t shz_vec2_add (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_add (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_add (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_sub (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_sub (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_sub (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_mul (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_mul (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_mul (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_div (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_div (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_div (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_scale (shz_vec2_t vec, float factor) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_scale (shz_vec3_t vec, float factor) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_scale (shz_vec4_t vec, float factor) SHZ_NOEXCEPT
 
Magnitude

Math routines for vector length and normalization.

float shz_vec2_magnitude_sqr (shz_vec2_t vec) SHZ_NOEXCEPT
 
float shz_vec4_magnitude_sqr (shz_vec4_t vec) SHZ_NOEXCEPT
 
float shz_vec3_magnitude_sqr (shz_vec3_t vec) SHZ_NOEXCEPT
 
float shz_vec2_magnitude (shz_vec2_t vec) SHZ_NOEXCEPT
 
float shz_vec3_magnitude (shz_vec3_t vec) SHZ_NOEXCEPT
 
float shz_vec4_magnitude (shz_vec4_t vec) SHZ_NOEXCEPT
 
float shz_vec2_magnitude_inv (shz_vec2_t vec) SHZ_NOEXCEPT
 
float shz_vec3_magnitude_inv (shz_vec3_t vec) SHZ_NOEXCEPT
 
float shz_vec4_magnitude_inv (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_normalize (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_normalize (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_normalize (shz_vec4_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_normalize_safe (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_normalize_safe (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_normalize_safe (shz_vec4_t vec) SHZ_NOEXCEPT
 
Binary Operations

Linear algebra operations performed with multiple vectors.

float shz_vec2_dot (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_dot2 (shz_vec2_t l, shz_vec2_t r1, shz_vec2_t r2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec2_dot3 (shz_vec2_t l, shz_vec2_t r1, shz_vec2_t r2, shz_vec2_t r3) SHZ_NOEXCEPT
 
float shz_vec3_dot (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec3_dot2 (shz_vec3_t l, shz_vec3_t r1, shz_vec3_t r2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_dot3 (shz_vec3_t l, shz_vec3_t r1, shz_vec3_t r2, shz_vec3_t r3) SHZ_NOEXCEPT
 
float shz_vec4_dot (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec4_dot2 (shz_vec4_t l, shz_vec4_t r1, shz_vec4_t r2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec4_dot3 (shz_vec4_t l, shz_vec4_t r1, shz_vec4_t r2, shz_vec4_t r3) SHZ_NOEXCEPT
 
float shz_vec2_distance (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
float shz_vec3_distance (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
float shz_vec4_distance (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
float shz_vec2_distance_sqr (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
float shz_vec3_distance_sqr (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
float shz_vec4_distance_sqr (shz_vec4_t vec1, shz_vec4_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_move (shz_vec2_t vec, shz_vec2_t target, float max_distance) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_move (shz_vec3_t vec, shz_vec3_t target, float max_distance) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_move (shz_vec4_t vec, shz_vec4_t target, float max_distance) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_lerp (shz_vec2_t a, shz_vec2_t b, float t) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_lerp (shz_vec3_t a, shz_vec3_t b, float t) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_lerp (shz_vec4_t a, shz_vec4_t b, float t) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_reflect (shz_vec2_t incidence, shz_vec2_t normal) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_reflect (shz_vec3_t incidence, shz_vec3_t normal) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_reflect (shz_vec4_t incidence, shz_vec4_t normal) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_refract (shz_vec2_t incidence, shz_vec2_t normal, float eta) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_refract (shz_vec3_t incidence, shz_vec3_t normal, float eta) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_refract (shz_vec4_t incidence, shz_vec4_t normal, float eta) SHZ_NOEXCEPT
 
float shz_vec2_cross (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_cross (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_project (shz_vec2_t vec, shz_vec2_t onto) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_project (shz_vec3_t vec, shz_vec3_t onto) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_project (shz_vec4_t vec, shz_vec4_t onto) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_project_safe (shz_vec2_t vec, shz_vec2_t onto) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_project_safe (shz_vec3_t vec, shz_vec3_t onto) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_project_safe (shz_vec4_t vec, shz_vec4_t onto) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_reject (shz_vec3_t vec, shz_vec3_t onto) SHZ_NOEXCEPT
 
Miscellaneous

Other specialized vector routines.

float shz_vec3_triple (shz_vec3_t a, shz_vec3_t b, shz_vec3_t c) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_perp (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_barycenter (shz_vec3_t p, shz_vec3_t a, shz_vec3_t b, shz_vec3_t c) SHZ_NOEXCEPT
 
void shz_vec3_orthonormalize (shz_vec3_t in1, shz_vec3_t in2, shz_vec3_t *out1, shz_vec3_t *out2) SHZ_NOEXCEPT
 
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) SHZ_NOEXCEPT
 
Angles

Routines for working with vectors and angles.

float shz_vec2_angle_between (shz_vec2_t vec1, shz_vec2_t vec2) SHZ_NOEXCEPT
 
float shz_vec3_angle_between (shz_vec3_t vec1, shz_vec3_t vec2) SHZ_NOEXCEPT
 
float shz_vec2_angle (shz_vec2_t vec) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_angles (shz_vec3_t vec) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_from_sincos (shz_sincos_t sincos) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_from_sincos (shz_sincos_t azimuth, shz_sincos_t elevation) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_from_angle (float radians) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_from_angles (float azimuth, float elevation) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_from_angle_deg (float degrees) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_from_angles_deg (float azimuth, float elevation) SHZ_NOEXCEPT
 
shz_vec2_t shz_vec2_rotate (shz_vec2_t vec, float radians) SHZ_NOEXCEPT
 
Extending

Routines for extending vectors into other dimensions.

shz_vec3_t shz_vec2_vec3 (shz_vec2_t vec, float z) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec2_vec4 (shz_vec2_t vec, float z, float w) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec3_vec4 (shz_vec3_t vec, float w) SHZ_NOEXCEPT
 
Swizzling

Routines for swizzling the order of a vector's components.

shz_vec2_t shz_vec2_swizzle (shz_vec2_t vec, unsigned x_idx, unsigned y_idx) SHZ_NOEXCEPT
 
shz_vec3_t shz_vec3_swizzle (shz_vec3_t vec, unsigned x_idx, unsigned y_idx, unsigned z_idx) SHZ_NOEXCEPT
 
shz_vec4_t shz_vec4_swizzle (shz_vec4_t vec, unsigned x_idx, unsigned y_idx, unsigned z_idx, unsigned w_idx) SHZ_NOEXCEPT
 

Detailed Description

Vector types and operations.

This file provides types and mathematical routines for representing and operating on vectors.

Author
2025, 2026 Falco Girgis
2025 Paul Cercueil

Definition in file shz_vector.h.

Macro Definition Documentation

◆ shz_vec2_deref

#define shz_vec2_deref ( ptr)

Dereferences the given pointer to a sequence of 2 floats as a shz_vec2_t.

Definition at line 677 of file shz_vector.h.

◆ shz_vec3_deref

#define shz_vec3_deref ( ptr)

Dereferences the given pointer to a sequence of 3 floats as a shz_vec3_t.

Definition at line 680 of file shz_vector.h.

◆ shz_vec4_deref

#define shz_vec4_deref ( ptr)

Dereferences the given pointer to a sequence of 4 floats as a shz_vec4_t.

Definition at line 683 of file shz_vector.h.

◆ shz_vec2_from

#define shz_vec2_from ( value)

Converts the given value or expression to the equivalent 2D SH4ZAM vector value.

Definition at line 686 of file shz_vector.h.

◆ shz_vec3_from

#define shz_vec3_from ( value)

Converts the given value or expression to the equivalent 3D SH4ZAM vector value.

Definition at line 689 of file shz_vector.h.

◆ shz_vec4_from

#define shz_vec4_from ( value)

Converts the given value or expression to the equivalent 4D SH4ZAM vector value.

Definition at line 692 of file shz_vector.h.

◆ shz_vec2_to

#define shz_vec2_to ( type,
vector )

Converts the given 2D vector into a value of the given type.

Definition at line 695 of file shz_vector.h.

◆ shz_vec3_to

#define shz_vec3_to ( type,
vector )

Converts the given 3D vector into a value of the given type.

Definition at line 698 of file shz_vector.h.

◆ shz_vec4_to

#define shz_vec4_to ( type,
vector )

Converts the given 4D vector into a value of the given type.

Definition at line 701 of file shz_vector.h.

◆ shz_vec_abs

#define shz_vec_abs ( vec)

C type-generic vector absolute value.

Definition at line 713 of file shz_vector.h.

713# define shz_vec_abs(vec) \
714 _Generic((vec), \
715 shz_vec2_t: shz_vec2_abs, \
716 shz_vec3_t: shz_vec3_abs, \
717 shz_vec4_t: shz_vec4_abs)(vec)

◆ shz_vec_neg

#define shz_vec_neg ( vec)

C type-generic vector negation.

Definition at line 720 of file shz_vector.h.

720# define shz_vec_neg(vec) \
721 _Generic((vec), \
722 shz_vec2_t: shz_vec2_neg, \
723 shz_vec3_t: shz_vec3_neg, \
724 shz_vec4_t: shz_vec4_neg)(vec)

◆ shz_vec_inv

#define shz_vec_inv ( vec)

C type-generic vector inversion.

Definition at line 727 of file shz_vector.h.

727# define shz_vec_inv(vec) \
728 _Generic((vec), \
729 shz_vec2_t: shz_vec2_inv, \
730 shz_vec3_t: shz_vec3_inv, \
731 shz_vec4_t: shz_vec4_inv)(vec)

◆ shz_vec_max

#define shz_vec_max ( vec)

C type-generic vector maximum value.

Definition at line 734 of file shz_vector.h.

734# define shz_vec_max(vec) \
735 _Generic((vec), \
736 shz_vec2_t: shz_vec2_max, \
737 shz_vec3_t: shz_vec3_max, \
738 shz_vec4_t: shz_vec4_max)(vec)

◆ shz_vec_min

#define shz_vec_min ( vec)

C type-generic vector minimum value.

Definition at line 741 of file shz_vector.h.

741# define shz_vec_min(vec) \
742 _Generic((vec), \
743 shz_vec2_t: shz_vec2_min, \
744 shz_vec3_t: shz_vec3_min, \
745 shz_vec4_t: shz_vec4_min)(vec)

◆ shz_vec_clamp

#define shz_vec_clamp ( vec,
min,
max )

C type-generic vector minimum value.

Definition at line 748 of file shz_vector.h.

748# define shz_vec_clamp(vec, min, max) \
749 _Generic((vec), \
750 shz_vec2_t: shz_vec2_clamp, \
751 shz_vec3_t: shz_vec3_clamp, \
752 shz_vec4_t: shz_vec4_clamp)(vec, min, max)

◆ shz_vec_equal

#define shz_vec_equal ( vec1,
vec2 )

C type-generic vector equals.

Definition at line 755 of file shz_vector.h.

755# define shz_vec_equal(vec1, vec2) \
756 _Generic((vec1), \
757 shz_vec2_t: shz_vec2_equal, \
758 shz_vec3_t: shz_vec3_equal, \
759 shz_vec4_t: shz_vec4_equal)(vec1, vec2)

◆ shz_vec_add

#define shz_vec_add ( vec1,
vec2 )

C type-generic vector addition.

Definition at line 762 of file shz_vector.h.

762# define shz_vec_add(vec1, vec2) \
763 _Generic((vec1), \
764 shz_vec2_t: shz_vec2_add, \
765 shz_vec3_t: shz_vec3_add, \
766 shz_vec4_t: shz_vec4_add)(vec1, vec2)

◆ shz_vec_sub

#define shz_vec_sub ( vec1,
vec2 )

C type-generic vector subtraction.

Definition at line 769 of file shz_vector.h.

769# define shz_vec_sub(vec1, vec2) \
770 _Generic((vec1), \
771 shz_vec2_t: shz_vec2_sub, \
772 shz_vec3_t: shz_vec3_sub, \
773 shz_vec4_t: shz_vec4_sub)(vec1, vec2)

◆ shz_vec_mul

#define shz_vec_mul ( vec1,
vec2 )

C type-generic vector multiplication.

Definition at line 776 of file shz_vector.h.

776# define shz_vec_mul(vec1, vec2) \
777 _Generic((vec1), \
778 shz_vec2_t: shz_vec2_mul, \
779 shz_vec3_t: shz_vec3_mul, \
780 shz_vec4_t: shz_vec4_mul)(vec1, vec2)

◆ shz_vec_div

#define shz_vec_div ( vec1,
vec2 )

C type-generic vector division.

Definition at line 783 of file shz_vector.h.

783# define shz_vec_div(vec1, vec2) \
784 _Generic((vec1), \
785 shz_vec2_t: shz_vec2_div, \
786 shz_vec3_t: shz_vec3_div, \
787 shz_vec4_t: shz_vec4_div)(vec1, vec2)

◆ shz_vec_scale

#define shz_vec_scale ( vec,
factor )

C type-generic vector scaling.

Definition at line 790 of file shz_vector.h.

790# define shz_vec_scale(vec, factor) \
791 _Generic((vec), \
792 shz_vec2_t: shz_vec2_scale, \
793 shz_vec3_t: shz_vec3_scale, \
794 shz_vec4_t: shz_vec4_scale)(vec, factor)

◆ shz_vec_dot

#define shz_vec_dot ( vec1,
vec2 )

C type-generic vector dot product.

Definition at line 797 of file shz_vector.h.

797# define shz_vec_dot(vec1, vec2) \
798 _Generic((vec1), \
799 shz_vec2_t: shz_vec2_dot, \
800 shz_vec3_t: shz_vec3_dot, \
801 shz_vec4_t: shz_vec4_dot)(vec1, vec2)

◆ shz_vec_dot2

#define shz_vec_dot2 ( l,
r1,
r2 )

C type-generic vector chained double dot product.

Definition at line 804 of file shz_vector.h.

804# define shz_vec_dot2(l, r1, r2) \
805 _Generic((l), \
806 shz_vec2_t: shz_vec2_dot2, \
807 shz_vec3_t: shz_vec3_dot2, \
808 shz_vec4_t: shz_vec4_dot2)(l, r1, r2)

◆ shz_vec_dot3

#define shz_vec_dot3 ( l,
r1,
r2,
r3 )

C type-generic vector chained triple dot product.

Definition at line 811 of file shz_vector.h.

811# define shz_vec_dot3(l, r1, r2, r3) \
812 _Generic((l), \
813 shz_vec2_t: shz_vec2_dot3, \
814 shz_vec3_t: shz_vec3_dot3, \
815 shz_vec4_t: shz_vec4_dot3)(l, r1, r2, r3)

◆ shz_vec_magnitude_sqr

#define shz_vec_magnitude_sqr ( vec)

C type-generic vector squared magnitude.

Definition at line 818 of file shz_vector.h.

818# define shz_vec_magnitude_sqr(vec) \
819 _Generic((vec), \
820 shz_vec2_t: shz_vec2_magnitude_sqr, \
821 shz_vec3_t: shz_vec3_magnitude_sqr, \
822 shz_vec4_t: shz_vec4_magnitude_sqr)(vec)

◆ shz_vec_magnitude

#define shz_vec_magnitude ( vec)

C type-generic vector magnitude.

Definition at line 825 of file shz_vector.h.

825# define shz_vec_magnitude(vec) \
826 _Generic((vec), \
827 shz_vec2_t: shz_vec2_magnitude, \
828 shz_vec3_t: shz_vec3_magnitude, \
829 shz_vec4_t: shz_vec4_magnitude)(vec)

◆ shz_vec_magnitude_inv

#define shz_vec_magnitude_inv ( vec)

C type-generic vector inverse magnitude.

Definition at line 832 of file shz_vector.h.

832# define shz_vec_magnitude_inv(vec) \
833 _Generic((vec), \
834 shz_vec2_t: shz_vec2_magnitude_inv, \
835 shz_vec3_t: shz_vec3_magnitude_inv, \
836 shz_vec4_t: shz_vec4_magnitude_inv)(vec)

◆ shz_vec_normalize

#define shz_vec_normalize ( vec)

C type-generic vector normalization.

Definition at line 839 of file shz_vector.h.

839# define shz_vec_normalize(vec) \
840 _Generic((vec), \
841 shz_vec2_t: shz_vec2_normalize, \
842 shz_vec3_t: shz_vec3_normalize, \
843 shz_vec4_t: shz_vec4_normalize)(vec)

◆ shz_vec_normalize_safe

#define shz_vec_normalize_safe ( vec)

C type-generic safe vector normalization.

Definition at line 846 of file shz_vector.h.

846# define shz_vec_normalize_safe(vec) \
847 _Generic((vec), \
848 shz_vec2_t: shz_vec2_normalize_safe, \
849 shz_vec3_t: shz_vec3_normalize_safe, \
850 shz_vec4_t: shz_vec4_normalize_safe)(vec)

◆ shz_vec_distance

#define shz_vec_distance ( vec1,
vec2 )

C type-generic vector distance.

Definition at line 853 of file shz_vector.h.

853# define shz_vec_distance(vec1, vec2) \
854 _Generic((vec1), \
855 shz_vec2_t: shz_vec2_distance, \
856 shz_vec3_t: shz_vec3_distance, \
857 shz_vec4_t: shz_vec4_distance)(vec1, vec2)

◆ shz_vec_move

#define shz_vec_move ( vec,
target,
maxdist )

C type-generic vector move.

Definition at line 860 of file shz_vector.h.

860# define shz_vec_move(vec, target, maxdist) \
861 _Generic((vec), \
862 shz_vec2_t: shz_vec2_move, \
863 shz_vec3_t: shz_vec3_move, \
864 shz_vec4_t: shz_vec4_move)(vec, target, maxdist)

◆ shz_vec_distance_sqr

#define shz_vec_distance_sqr ( vec1,
vec2 )

C type-generic vector squared distance.

Definition at line 867 of file shz_vector.h.

867# define shz_vec_distance_sqr(vec1, vec2) \
868 _Generic((vec1), \
869 shz_vec2_t: shz_vec2_distance_sqr, \
870 shz_vec3_t: shz_vec3_distance_sqr, \
871 shz_vec4_t: shz_vec4_distance_sqr)(vec1, vec2)

◆ shz_vec_lerp

#define shz_vec_lerp ( vec1,
vec2,
t )

C type-generic linear interpolation between two vectors.

Definition at line 874 of file shz_vector.h.

874# define shz_vec_lerp(vec1, vec2, t) \
875 _Generic((vec1), \
876 shz_vec2_t: shz_vec2_lerp, \
877 shz_vec3_t: shz_vec3_lerp, \
878 shz_vec4_t: shz_vec4_lerp)(vec1, vec2, t)

◆ shz_vec_reflect

#define shz_vec_reflect ( incidence,
normal )

C type-generic vector reflection.

Definition at line 881 of file shz_vector.h.

881# define shz_vec_reflect(incidence, normal) \
882 _Generic((incidence), \
883 shz_vec2_t: shz_vec2_reflect, \
884 shz_vec3_t: shz_vec3_reflect, \
885 shz_vec4_t: shz_vec4_reflect)(incidence, normal)

◆ shz_vec_refract

#define shz_vec_refract ( incidence,
normal,
eta )

C type-generic vector refraction.

Definition at line 888 of file shz_vector.h.

888# define shz_vec_refract(incidence, normal, eta) \
889 _Generic((incidence), \
890 shz_vec2_t: shz_vec2_refract, \
891 shz_vec3_t: shz_vec3_refract, \
892 shz_vec4_t: shz_vec4_refract)(incidence, normal, eta)

◆ shz_vec_cross

#define shz_vec_cross ( vec1,
vec2 )

C type-generic vector cross-product.

Definition at line 895 of file shz_vector.h.

895# define shz_vec_cross(vec1, vec2) \
896 _Generic((vec1), \
897 shz_vec2_t: shz_vec2_cross, \
898 shz_vec3_t: shz_vec3_cross)(vec1, vec2)

◆ shz_vec_project

#define shz_vec_project ( vec1,
vec2 )

C type-generic vector projection.

Definition at line 901 of file shz_vector.h.

901# define shz_vec_project(vec1, vec2) \
902 _Generic((vec1), \
903 shz_vec2_t: shz_vec2_project, \
904 shz_vec3_t: shz_vec3_project, \
905 shz_vec4_t: shz_vec4_project)(vec1, vec2)

◆ shz_vec_project_safe

#define shz_vec_project_safe ( vec1,
vec2 )

C type-generic safe vector projection.

Definition at line 908 of file shz_vector.h.

908# define shz_vec_project_safe(vec1, vec2) \
909 _Generic((vec1), \
910 shz_vec2_t: shz_vec2_project_safe, \
911 shz_vec3_t: shz_vec3_project_safe, \
912 shz_vec4_t: shz_vec4_project_safe)(vec1, vec2)

◆ shz_vec_angles

#define shz_vec_angles ( vec)

C type-generic angle-from-vector extraction.

Definition at line 915 of file shz_vector.h.

915# define shz_vec_angles(vec) \
916 _Generic((vec), \
917 shz_vec2_t: shz_vec2_angle, \
918 shz_vec3_t: shz_vec3_angles)(vec)

◆ shz_vec_angle_between

#define shz_vec_angle_between ( vec1,
vec2 )

C type-generic angle between two vectors.

Definition at line 921 of file shz_vector.h.

921# define shz_vec_angle_between(vec1, vec2) \
922 _Generic((vec1), \
923 shz_vec2_t: shz_vec2_angle_between, \
924 shz_vec3_t: shz_vec3_angle_between)(vec1, vec2)

◆ shz_vec_swizzle

#define shz_vec_swizzle ( vec,
... )

C type-generic vector swizzling.

Definition at line 927 of file shz_vector.h.

927# define shz_vec_swizzle(vec, ...) \
928 _Generic((vec), \
929 shz_vec2_t: shz_vec2_swizzle, \
930 shz_vec3_t: shz_vec3_swizzle, \
931 shz_vec4_t: shz_vec4_swizzle)(vec, __VA_ARGS__)

◆ shz_vec_floor

#define shz_vec_floor ( vec)

C type-generic component-wise floor.

Definition at line 934 of file shz_vector.h.

934# define shz_vec_floor(vec) \
935 _Generic((vec), \
936 shz_vec2_t: shz_vec2_floor, \
937 shz_vec3_t: shz_vec3_floor, \
938 shz_vec4_t: shz_vec4_floor)(vec)

◆ shz_vec_ceil

#define shz_vec_ceil ( vec)

C type-generic component-wise ceil.

Definition at line 941 of file shz_vector.h.

941# define shz_vec_ceil(vec) \
942 _Generic((vec), \
943 shz_vec2_t: shz_vec2_ceil, \
944 shz_vec3_t: shz_vec3_ceil, \
945 shz_vec4_t: shz_vec4_ceil)(vec)

◆ shz_vec_round

#define shz_vec_round ( vec)

C type-generic component-wise round.

Definition at line 948 of file shz_vector.h.

948# define shz_vec_round(vec) \
949 _Generic((vec), \
950 shz_vec2_t: shz_vec2_round, \
951 shz_vec3_t: shz_vec3_round, \
952 shz_vec4_t: shz_vec4_round)(vec)

◆ shz_vec_fract

#define shz_vec_fract ( vec)

C type-generic component-wise fract.

Definition at line 955 of file shz_vector.h.

955# define shz_vec_fract(vec) \
956 _Generic((vec), \
957 shz_vec2_t: shz_vec2_fract, \
958 shz_vec3_t: shz_vec3_fract, \
959 shz_vec4_t: shz_vec4_fract)(vec)

◆ shz_vec_sign

#define shz_vec_sign ( vec)

C type-generic component-wise sign.

Definition at line 962 of file shz_vector.h.

962# define shz_vec_sign(vec) \
963 _Generic((vec), \
964 shz_vec2_t: shz_vec2_sign, \
965 shz_vec3_t: shz_vec3_sign, \
966 shz_vec4_t: shz_vec4_sign)(vec)

◆ shz_vec_saturate

#define shz_vec_saturate ( vec)

C type-generic component-wise saturate.

Definition at line 969 of file shz_vector.h.

969# define shz_vec_saturate(vec) \
970 _Generic((vec), \
971 shz_vec2_t: shz_vec2_saturate, \
972 shz_vec3_t: shz_vec3_saturate, \
973 shz_vec4_t: shz_vec4_saturate)(vec)

◆ shz_vec_minv

#define shz_vec_minv ( a,
b )

C type-generic pairwise minimum.

Definition at line 976 of file shz_vector.h.

976# define shz_vec_minv(a, b) \
977 _Generic((a), \
978 shz_vec2_t: shz_vec2_minv, \
979 shz_vec3_t: shz_vec3_minv, \
980 shz_vec4_t: shz_vec4_minv)(a, b)

◆ shz_vec_maxv

#define shz_vec_maxv ( a,
b )

C type-generic pairwise maximum.

Definition at line 983 of file shz_vector.h.

983# define shz_vec_maxv(a, b) \
984 _Generic((a), \
985 shz_vec2_t: shz_vec2_maxv, \
986 shz_vec3_t: shz_vec3_maxv, \
987 shz_vec4_t: shz_vec4_maxv)(a, b)

◆ shz_vec_stepv

#define shz_vec_stepv ( vec,
edge )

C type-generic component-wise step.

Definition at line 990 of file shz_vector.h.

990# define shz_vec_stepv(vec, edge) \
991 _Generic((vec), \
992 shz_vec2_t: shz_vec2_stepv, \
993 shz_vec3_t: shz_vec3_stepv, \
994 shz_vec4_t: shz_vec4_stepv)(vec, edge)

◆ shz_vec_step

#define shz_vec_step ( vec,
edge )

C type-generic step.

Definition at line 997 of file shz_vector.h.

997# define shz_vec_step(vec, edge) \
998 _Generic((vec), \
999 shz_vec2_t: shz_vec2_step, \
1000 shz_vec3_t: shz_vec3_step, \
1001 shz_vec4_t: shz_vec4_step)(vec, edge)

◆ shz_vec_smoothstepv

#define shz_vec_smoothstepv ( vec,
edge0,
edge1 )

C type-generic component-wise smoothstep.

Definition at line 1004 of file shz_vector.h.

1004# define shz_vec_smoothstepv(vec, edge0, edge1) \
1005 _Generic((vec), \
1006 shz_vec2_t: shz_vec2_smoothstepv, \
1007 shz_vec3_t: shz_vec3_smoothstepv, \
1008 shz_vec4_t: shz_vec4_smoothstepv)(vec, edge0, edge1)

◆ shz_vec_smoothstep

#define shz_vec_smoothstep ( vec,
edge0,
edge1 )

C type-generic smoothstep.

Definition at line 1011 of file shz_vector.h.

1011# define shz_vec_smoothstep(vec, edge0, edge1) \
1012 _Generic((vec), \
1013 shz_vec2_t: shz_vec2_smoothstep, \
1014 shz_vec3_t: shz_vec3_smoothstep, \
1015 shz_vec4_t: shz_vec4_smoothstep)(vec, edge0, edge1)

◆ shz_vec_smoothstepv_safe

#define shz_vec_smoothstepv_safe ( vec,
edge0,
edge1 )

C type-generic component-wise smoothstep_safe.

Definition at line 1018 of file shz_vector.h.

1018# define shz_vec_smoothstepv_safe(vec, edge0, edge1) \
1019 _Generic((vec), \
1020 shz_vec2_t: shz_vec2_smoothstepv_safe, \
1021 shz_vec3_t: shz_vec3_smoothstepv_safe, \
1022 shz_vec4_t: shz_vec4_smoothstepv_safe)(vec, edge0, edge1)

◆ shz_vec_smoothstep_safe

#define shz_vec_smoothstep_safe ( vec,
edge0,
edge1 )

C type-generic smoothstep_safe.

Definition at line 1025 of file shz_vector.h.

1025# define shz_vec_smoothstep_safe(vec, edge0, edge1) \
1026 _Generic((vec), \
1027 shz_vec2_t: shz_vec2_smoothstep_safe, \
1028 shz_vec3_t: shz_vec3_smoothstep_safe, \
1029 shz_vec4_t: shz_vec4_smoothstep_safe)(vec, edge0, edge1)

Typedef Documentation

◆ shz_vec2

Alternate typedef for the shz_vec2 struct for those who hate POSIX-style.

Definition at line 49 of file shz_vector.h.

◆ shz_vec3

Alternate typedef for the shz_vec3 struct for those who hate POSIX-style.

Definition at line 74 of file shz_vector.h.

◆ shz_vec4

Alternate typedef for the shz_vec4 struct for those who hate POSIX-style.

Definition at line 105 of file shz_vector.h.

Function Documentation

◆ 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()

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()

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()

shz_vec2_t shz_vec2_fill ( float v)

Returns a 2D vector with the value of each component equal to v.

◆ 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()

shz_vec4_t shz_vec4_fill ( float v)

Returns a 4D vector with the value of each component equal to v.

◆ 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()

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()

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()

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()

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()

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()

shz_vec2_t shz_vec2_inv ( shz_vec2_t vec)

Returns the 2D vector whose components have been inverted or reciprocated.

◆ 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()

shz_vec4_t shz_vec4_inv ( shz_vec4_t vec)

Returns the 4D vector whose components have been inverted or reciprocated.

◆ 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()

float shz_vec3_max ( shz_vec3_t vec)

Returns the maximum value of the given vector's 3 components.

◆ 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()

float shz_vec2_min ( shz_vec2_t vec)

Retuns the minimum value of both of the given vector's components.

◆ 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()

float shz_vec4_min ( shz_vec4_t vec)

Returns the minimum value of the given vector's 4 components.

◆ 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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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_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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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.

◆ 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()

float shz_vec4_magnitude_sqr ( shz_vec4_t vec)

Returns the squared magnitude of the given 4D 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()

float shz_vec2_magnitude ( shz_vec2_t vec)

Returns the magnitude of the given 2D vector.

◆ shz_vec3_magnitude()

float shz_vec3_magnitude ( shz_vec3_t vec)

Returns the magnitude of the given 3D vector.

◆ shz_vec4_magnitude()

float shz_vec4_magnitude ( shz_vec4_t vec)

Returns the magnitude of the given 4D 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()

float shz_vec3_magnitude_inv ( shz_vec3_t vec)

Returns the inverse magnitude of the given 3D 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()

shz_vec2_t shz_vec2_normalize ( shz_vec2_t vec)

Returns a normalized unit vector from the given 2D 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()

shz_vec4_t shz_vec4_normalize ( shz_vec4_t vec)

Returns a normalized unit vector from the given 4D 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.

If the vector's magnitude is not > 0.0f, safely returns a zero 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.

If the vector's magnitude is not > 0.0f, safely returns a zero 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.

If the vector's magnitude is not > 0.0f, safely returns a zero 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()

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()

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()

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()

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()

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()

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()

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()

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()

float shz_vec2_distance ( shz_vec2_t vec1,
shz_vec2_t vec2 )

Returns the distance between the two given 2D vectors.

◆ 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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

float shz_vec2_cross ( shz_vec2_t vec1,
shz_vec2_t vec2 )

Returns the cross product, as a scalar, between two 2D vectors.

Note
The definition of the cross-product is ambiguous in 2D space, but the geometric interpretation here is that the result is the magnitude of the orthogonal vector created from the given two along the Z-axis.

◆ 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()

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()

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()

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()

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.

Note
This routine should safely return the zero vector when vec has a magnitude of 0.0f.

◆ 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.

Note
This routine should safely return the zero vector when vec has a magnitude of 0.0f.

◆ 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.

Note
This routine should safely return the zero vector when vec has a magnitude of 0.0f.

◆ 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.

◆ 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()

shz_vec3_t shz_vec3_perp ( shz_vec3_t vec)

Returns a vector which is perpendicular to the given 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()

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()

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.

◆ 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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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_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()

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()

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.

◆ 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()

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()

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.