PowerBlocks SDK
 
Loading...
Searching...
No Matches
vec3.h File Reference

Simple 3D vectors. More...

#include <math.h>

Go to the source code of this file.

Classes

struct  vec3
 

Macros

#define vec3_new(x, y, z)
 
#define vec3_add(a, b)
 
#define vec3_sub(a, b)
 
#define vec3_dot(a, b)
 
#define vec3_magnitude_sq(a)
 
#define vec3_magnitude(a)
 
#define vec3_muls(a, s)
 
#define vec3_divs(a, s)
 

Functions

void vec3_normalize (vec3 *v)
 
vec3 vec3_to (vec3 a, vec3 b)
 

Detailed Description

Simple 3D vectors.

Provides helper functions and data structures for 3D vectors.

Author
Samuel Fitzsimons (rainbain)
Date
2025 @license MIT (see LICENSE file)

Macro Definition Documentation

◆ vec3_add

#define vec3_add ( a,
b )
Value:
((vec3){(a).x+(b).x, (a).y+(b).y, (a).z+(b).z})
Definition vec3.h:16

◆ vec3_divs

#define vec3_divs ( a,
s )
Value:
((vec3){(a).x/(s), (a).y/(s), (a).z/(s)})

◆ vec3_dot

#define vec3_dot ( a,
b )
Value:
((a).x * (b).x + (a).y * (b).y + (a.z) * (b).z)

◆ vec3_magnitude

#define vec3_magnitude ( a)
Value:
(sqrtf(vec3_magnitude_sq(a)))

◆ vec3_magnitude_sq

#define vec3_magnitude_sq ( a)
Value:
vec3_dot(a, a)

◆ vec3_muls

#define vec3_muls ( a,
s )
Value:
((vec3){(a).x*(s), (a).y*(s), (a).z*(s)})

◆ vec3_new

#define vec3_new ( x,
y,
z )
Value:
((vec3){x, y, z})

◆ vec3_sub

#define vec3_sub ( a,
b )
Value:
((vec3){(a).x-(b).x, (a).y-(b).y, (a).z-(b).z})