Add component-wise vector and quaternion division.

Mostly for non-uniform scaling.
This commit is contained in:
Bill Currie 2012-05-09 09:50:42 +09:00
parent 215d2e9747
commit 724427a976

View file

@ -110,6 +110,12 @@ extern const vec_t *const quat_origin;
(c)[1] = (a)[1] * (b)[1]; \
(c)[2] = (a)[2] * (b)[2]; \
} while (0)
#define VectorCompDiv(a,b,c) \
do { \
(c)[0] = (a)[0] / (b)[0]; \
(c)[1] = (a)[1] / (b)[1]; \
(c)[2] = (a)[2] / (b)[2]; \
} while (0)
#define VectorCompCompare(x, op, y) \
(((x)[0] op (y)[0]) && ((x)[1] op (y)[1]) && ((x)[2] op (y)[2]))
#define VectorCompare(x, y) VectorCompCompare (x, ==, y)
@ -230,6 +236,13 @@ extern const vec_t *const quat_origin;
(c)[2] = (a)[2] * (b)[2]; \
(c)[3] = (a)[3] * (b)[3]; \
} while (0)
#define QuatCompDiv(a,b,c) \
do { \
(c)[0] = (a)[0] / (b)[0]; \
(c)[1] = (a)[1] / (b)[1]; \
(c)[2] = (a)[2] / (b)[2]; \
(c)[3] = (a)[3] / (b)[3]; \
} while (0)
#define QuatCompCompare(x, op, y) \
(((x)[0] op (y)[0]) && ((x)[1] op (y)[1]) \
&& ((x)[2] op (y)[2]) && ((x)[3] op (y)[3]))