9#define VEC2_EPSILON 1e-7
72 float l = sqrtf(v.
x * v.
x + v.
y * v.
y);
static vec2 vec2_add(vec2 a, vec2 b)
{.x = a.x + b.x, .y = a.y + b.y}
Definition vec2.h:33
static norm2 vec2_normalize(vec2 v)
Returns a vector of length 1. Returns the 0 vector for vectors of length VEC2_EPSILON and smaller.
Definition vec2.h:67
static vec2 vec2_sub(vec2 a, vec2 b)
{.x = a.x - b.x, .y = a.y - b.y}
Definition vec2.h:41
static vec2 vec2_scale(vec2 a, float c)
{.x = c * a.x, .y = c * a.y}
Definition vec2.h:49
static float vec2_dot(vec2 a, vec2 b)
Returns a scalar product of the two vectors.
Definition vec2.h:83
float y
Definition vec2.h:12
static vec2 vec2_perpendicular(vec2 v)
{.x = -y, .y = x}
Definition vec2.h:57
float x
Definition vec2.h:12
#define VEC2_EPSILON
The vectors of this length and smaller are considered 0.
Definition vec2.h:9
vec2 norm2
Normalized vector. Does not do any work to uphold a variants, just is more type-safe....
Definition vec2.h:18
static vec2 vec2_zero()
{.x = 0, .y = 0}
Definition vec2.h:29
static vec2 vec2_new(float x, float y)
{.x = x, .y = y}
Definition vec2.h:21