Subastra
Loading...
Searching...
No Matches
Static Public Member Functions | Data Fields
vec2 Struct Reference

#include <vec2.h>

Static Public Member Functions

static vec2 vec2_add (vec2 a, vec2 b)
 {.x = a.x + b.x, .y = a.y + b.y}
 
static vec2 vec2_sub (vec2 a, vec2 b)
 {.x = a.x - b.x, .y = a.y - b.y}
 
static vec2 vec2_scale (vec2 a, float c)
 {.x = c * a.x, .y = c * a.y}
 
static vec2 vec2_perpendicular (vec2 v)
 {.x = -y, .y = x}
 
static norm2 vec2_normalize (vec2 v)
 Returns a vector of length 1. Returns the 0 vector for vectors of length VEC2_EPSILON and smaller.
 
static float vec2_dot (vec2 a, vec2 b)
 Returns a scalar product of the two vectors.
 

Data Fields

float x
 
float y
 

Member Function Documentation

◆ vec2_add()

static vec2 vec2_add ( vec2  a,
vec2  b 
)
static

{.x = a.x + b.x, .y = a.y + b.y}

◆ vec2_dot()

static float vec2_dot ( vec2  a,
vec2  b 
)
static

Returns a scalar product of the two vectors.

◆ vec2_normalize()

static norm2 vec2_normalize ( vec2  v)
static

Returns a vector of length 1. Returns the 0 vector for vectors of length VEC2_EPSILON and smaller.

◆ vec2_perpendicular()

static vec2 vec2_perpendicular ( vec2  v)
static

{.x = -y, .y = x}

◆ vec2_scale()

static vec2 vec2_scale ( vec2  a,
float  c 
)
static

{.x = c * a.x, .y = c * a.y}

◆ vec2_sub()

static vec2 vec2_sub ( vec2  a,
vec2  b 
)
static

{.x = a.x - b.x, .y = a.y - b.y}

Field Documentation

◆ x

float x

◆ y

float y