X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=gph-cmath;a=blobdiff_plain;f=src%2Fcgmath.inl;fp=src%2Fcgmath.inl;h=0000000000000000000000000000000000000000;hp=081452cbe3669d8fd166f2c895cd7fc4a83de118;hb=cc26f59c90c0935eef7d7fdcf8ac327e23d14ebc;hpb=b5babc8bdd95af48fc377bb888c70aad4956d58a diff --git a/src/cgmath.inl b/src/cgmath.inl deleted file mode 100644 index 081452c..0000000 --- a/src/cgmath.inl +++ /dev/null @@ -1,76 +0,0 @@ -static inline void cgm_vadd(cgm_vec3 *a, const cgm_vec3 *b) -{ - a->x += b->x; - a->y += b->y; - a->z += b->z; -} - -static inline void cgm_vsub(cgm_vec3 *a, const cgm_vec3 *b) -{ - a->x -= b->x; - a->y -= b->y; - a->z -= b->z; -} - -static inline void cgm_vmul(cgm_vec3 *a, const cgm_vec3 *b) -{ - a->x *= b->x; - a->y *= b->y; - a->z *= b->z; -} - -static inline void cgm_vscale(cgm_vec3 *v, float s) -{ - v->x *= s; - v->y *= s; - v->z *= s; -} - -static inline float cgm_vdot(const cgm_vec3 *a, const cgm_vec3 *b) -{ - return a->x * b->x + a->y * b->y + a->z * b->z; -} - -static inline void cgm_vcross(cgm_vec3 *res, const cgm_vec3 *a, const cgm_vec3 *b) -{ - res->x = a->y * b->z - a->z * b->y; - res->y = a->z * b->x - a->x * b->z; - res->z = a->x * b->y - a->y * b->x; -} - -static inline float cgm_vlength(const cgm_vec3 *v) -{ - return sqrt(v->x * v->x + v->y * v->y + v->z * v->z); -} - -static inline float cgm_vlength_sq(const cgm_vec3 *v) -{ - return v->x * v->x + v->y * v->y + v->z * v->z; -} - -static inline float cgm_vdist(const cgm_vec3 *a, const cgm_vec3 *b) -{ - float dx = a->x - b->x; - float dy = a->y - b->y; - float dz = a->z - b->z; - return sqrt(dx * dx + dy * dy + dz * dz); -} - -static inline float cgm_vdist_sq(const cgm_vec3 *a, const cgm_vec3 *b) -{ - float dx = a->x - b->x; - float dy = a->y - b->y; - float dz = a->z - b->z; - return dx * dx + dy * dy + dz * dz; -} - -static inline void cgm_vnormalize(cgm_vec3 *v) -{ - float len = cgm_vlength(v); - if(len != 0.0f) { - float s = 1.0f / len; - v->x *= s; - v->y *= s; - v->z *= s; - } -}