Add test macro and a few more functions
This commit is contained in:
parent
c171a2ff7a
commit
2ff1e0791b
3 changed files with 65 additions and 12 deletions
|
|
@ -18,7 +18,19 @@ static inline struct Vec3 vec3_add(struct Vec3 a, struct Vec3 b) {
|
|||
return c;
|
||||
}
|
||||
|
||||
static inline bool vec3_eql_tol(struct Vec3 a, struct Vec3 b, double tol) {
|
||||
static inline struct Vec3 vec3_sub(struct Vec3 a, struct Vec3 b) {
|
||||
struct Vec3 c;
|
||||
c.x = a.x - b.x;
|
||||
c.y = a.y - b.y;
|
||||
c.z = a.z - b.z;
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline double vec3_dot(struct Vec3 a, struct Vec3 b) {
|
||||
return a.x * b.x + a.y * b.y + a.z * b.z;
|
||||
}
|
||||
|
||||
static inline int vec3_eql_tol(struct Vec3 a, struct Vec3 b, double tol) {
|
||||
return fabs(a.x - b.x) < tol && fabs(a.y - b.y) < tol &&
|
||||
fabs(a.z - b.z) < tol;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue