From 94362cc01080f1d327689da5446f9980a9973890 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 5 Sep 2011 18:10:02 +0900 Subject: [PATCH] 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. --- include/QF/mathlib.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index b16b6b70a..7fbf0e828 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -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),