forked from kdx/jtmm2-old
26 lines
494 B
C
26 lines
494 B
C
#ifndef _DEF_VEC
|
|
#define _DEF_VEC
|
|
|
|
typedef struct Vec
|
|
{
|
|
float x;
|
|
float y;
|
|
} Vec;
|
|
|
|
/* like memcpy but for vectors */
|
|
void vec_cpy(Vec *destination, Vec *source);
|
|
|
|
/* apply a force on a vector */
|
|
void vec_add(Vec *vector, Vec force);
|
|
|
|
/* apply the opposite of a force on a vector */
|
|
void vec_sub(Vec *vector, Vec force);
|
|
|
|
/* multiply a vector by a scale */
|
|
void vec_mul(Vec *vector, float scale);
|
|
|
|
/* divise a vector by a scale */
|
|
void vec_div(Vec *vector, float scale);
|
|
|
|
#endif /* _DEF_VEC */
|