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_t
struct  bj_vec3_t
struct  bj_vec4_t

Macros

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

Typedefs

typedef struct bj_vec2_t bj_vec2
typedef struct bj_vec3_t bj_vec3
typedef struct bj_vec4_t bj_vec4

Functions

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