Add macros to ease printing of vectors and quaternions.

I got sick of having to pass all those parameters to printf. Let the
compiler do it for me.
This commit is contained in:
Bill Currie 2011-09-05 18:10:02 +09:00
parent a3f0a559a5
commit 94362cc010

View file

@ -114,6 +114,9 @@ extern const vec_t * const quat_origin;
(v)[2] = (v1)[2] * (1 - (b)) + (v2)[2] * (b); \
} while (0)
//For printf etc
#define VectorExpand(v) (v)[0], (v)[1], (v)[2]
#define QDotProduct(a,b) ((a)[0] * (b)[0] + (a)[1] * (b)[1] \
+ (a)[2] * (b)[2] + (a)[3] * (b)[3])
#define QuatSubtract(a,b,c) \
@ -196,6 +199,9 @@ extern const vec_t * const quat_origin;
(v)[3] = (v1)[3] * (1 - (b)) + (v2)[3] * (b); \
} while (0)
//For printf etc
#define QuatExpand(q) (q)[0], (q)[1], (q)[2], (q)[3]
/*
* VectorDistance, the distance between two points.
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),