#ifndef __QMATH_H__ #define __QMATH_H__ MATRIX *RotMatrixQ(SVECTOR *r, MATRIX *m); #define m_dot12(a, b) ((((int)((a)->vx) * (b)->vx) >> 12) + (((int)((a)->vy) * (b)->vy) >> 12) + (((int)((a)->vz) * (b)->vz) >> 12)) // TODO: worth a benchmark: is it faster to copy these vectors and use them from the stack, or to do six pointer dereferences? INLINE int m_pointPlaneDist2(const VECTOR* point2, const SVECTOR* normal12, int dist2) { int x = ((int)point2->vx * normal12->vx) >> 12; int y = ((int)point2->vy * normal12->vy) >> 12; int z = ((int)point2->vz * normal12->vz) >> 12; return (x + y + z - dist2); } #endif // __QMATH_H__