Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
vec.h File Reference
#include <banjo/api.h>
#include <banjo/math.h>
Include dependency graph for vec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bj_vec2
struct  bj_vec3
struct  bj_vec4

Macros

#define BJ_VEC2_ZERO   ((struct bj_vec2){BJ_FZERO, BJ_FZERO})
#define BJ_VEC3_ZERO   ((struct bj_vec3){BJ_FZERO, BJ_FZERO, BJ_FZERO})
#define BJ_VEC4_ZERO   ((struct bj_vec4){BJ_FZERO, BJ_FZERO, BJ_FZERO, BJ_FZERO})

Functions

static struct bj_vec2 bj_vec2_map (struct bj_vec2 a, bj_real(*f)(bj_real))
static struct bj_vec2 bj_vec2_add (struct bj_vec2 lhs, struct bj_vec2 rhs)
static struct bj_vec2 bj_vec2_add_scaled (struct bj_vec2 lhs, struct bj_vec2 rhs, bj_real s)
static struct bj_vec2 bj_vec2_sub (const struct bj_vec2 lhs, const struct bj_vec2 rhs)
static struct bj_vec2 bj_vec2_scale (struct bj_vec2 v, bj_real s)
static struct bj_vec2 bj_vec2_mul_comp (const struct bj_vec2 v, const struct bj_vec2 s)
static bj_real bj_vec2_dot (struct bj_vec2 a, struct bj_vec2 b)
static bj_real bj_vec2_perp_dot (struct bj_vec2 a, struct bj_vec2 b)
static bj_real bj_vec2_len (struct bj_vec2 v)
static struct bj_vec2 bj_vec2_scale_to_len (struct bj_vec2 v, bj_real L)
static bj_real bj_vec2_distance_sq (struct bj_vec2 a, struct bj_vec2 b)
static bj_real bj_vec2_distance (const struct bj_vec2 a, const struct bj_vec2 b)
static struct bj_vec2 bj_vec2_normalize (struct bj_vec2 v)
static struct bj_vec2 bj_vec2_normalize_unsafe (struct bj_vec2 v)
static struct bj_vec2 bj_vec2_min (struct bj_vec2 a, struct bj_vec2 b)
static struct bj_vec2 bj_vec2_max (struct bj_vec2 a, struct bj_vec2 b)
static struct bj_vec3 bj_vec3_map (struct bj_vec3 a, bj_real(*f)(bj_real))
static struct bj_vec3 bj_vec3_add (struct bj_vec3 lhs, struct bj_vec3 rhs)
static struct bj_vec3 bj_vec3_add_scaled (struct bj_vec3 lhs, struct bj_vec3 rhs, bj_real s)
static struct bj_vec3 bj_vec3_sub (struct bj_vec3 lhs, struct bj_vec3 rhs)
static struct bj_vec3 bj_vec3_scale (struct bj_vec3 v, bj_real s)
static bj_real bj_vec3_dot (struct bj_vec3 a, struct bj_vec3 b)
static bj_real bj_vec3_len (struct bj_vec3 v)
static struct bj_vec3 bj_vec3_scale_to_len (struct bj_vec3 v, bj_real L)
static bj_real bj_vec3_distance_sq (struct bj_vec3 a, struct bj_vec3 b)
static bj_real bj_vec3_distance (struct bj_vec3 a, struct bj_vec3 b)
static struct bj_vec3 bj_vec3_normalize (struct bj_vec3 v)
static struct bj_vec3 bj_vec3_normalize_unsafe (struct bj_vec3 v)
static struct bj_vec3 bj_vec3_min (struct bj_vec3 a, struct bj_vec3 b)
static struct bj_vec3 bj_vec3_max (struct bj_vec3 a, struct bj_vec3 b)
static struct bj_vec3 bj_vec3_cross (struct bj_vec3 l, struct bj_vec3 r)
static struct bj_vec3 bj_vec3_reflect (struct bj_vec3 v, struct bj_vec3 n)
static struct bj_vec4 bj_vec4_map (struct bj_vec4 a, bj_real(*f)(bj_real))
static struct bj_vec4 bj_vec4_add (struct bj_vec4 lhs, struct bj_vec4 rhs)
static struct bj_vec4 bj_vec4_add_scaled (struct bj_vec4 lhs, struct bj_vec4 rhs, bj_real s)
static struct bj_vec4 bj_vec4_sub (struct bj_vec4 lhs, struct bj_vec4 rhs)
static struct bj_vec4 bj_vec4_scale (struct bj_vec4 v, bj_real s)
static bj_real bj_vec4_dot (struct bj_vec4 a, struct bj_vec4 b)
static bj_real bj_vec4_len (struct bj_vec4 v)
static struct bj_vec4 bj_vec4_normalize (struct bj_vec4 v)
static struct bj_vec4 bj_vec4_normalize_unsafe (struct bj_vec4 v)
static struct bj_vec4 bj_vec4_min (struct bj_vec4 a, struct bj_vec4 b)
static struct bj_vec4 bj_vec4_max (struct bj_vec4 a, struct bj_vec4 b)
static struct bj_vec4 bj_vec4_cross_xyz (struct bj_vec4 l, struct bj_vec4 r)
static struct bj_vec4 bj_vec4_reflect (struct bj_vec4 v, struct bj_vec4 n)

Detailed Description

vector manipulation API

Provides simple, inline operations (set, add, sub, scale, dot, length, normalize, min/max, copy, cross, reflect) on fixed-size vectors.

Vector utilities for 2D, 3D, and 4D using bj_real.

All functions are header-only and suitable for high-performance code.