cgmath initial commit
[gph-cmath] / src / cgmath.h
1 /* C version of the graphene math library */
2 #ifndef CGMATH_H_
3 #define CGMATH_H_
4
5 #include <math.h>
6
7 typedef struct {
8         float x, y, z;
9 } cgm_vec3;
10
11 typedef struct {
12         float x, y, z, w;
13 } cgm_quat;
14
15 static inline void cgm_vadd(cgm_vec3 *a, const cgm_vec3 *b);
16 static inline void cgm_vsub(cgm_vec3 *a, const cgm_vec3 *b);
17 static inline void cgm_vmul(cgm_vec3 *a, const cgm_vec3 *b);
18 static inline void cgm_vscale(cgm_vec3 *v, float s);
19
20 static inline float cgm_vdot(const cgm_vec3 *a, const cgm_vec3 *b);
21 static inline void cgm_vcross(cgm_vec3 *res, const cgm_vec3 *a, const cgm_vec3 *b);
22 static inline float cgm_vlength(const cgm_vec3 *v);
23 static inline float cgm_vlength_sq(const cgm_vec3 *v);
24 static inline float cgm_vdist(const cgm_vec3 *a, const cgm_vec3 *b);
25 static inline float cgm_vdist_sq(const cgm_vec3 *a, const cgm_vec3 *b);
26 static inline void cgm_vnormalize(cgm_vec3 *v);
27
28 #include "cgmath.inl"
29
30 #endif  /* CGMATH_H_ */