/***** BallAux.h - Vector and quaternion routines for Arcball. *****/ #ifndef _H_BallAux #define _H_BallAux typedef struct { float x, y, z, w; } Quat; enum QuatPart { XX, YY, ZZ, WW, QuatLen }; typedef Quat HVect; typedef float HMatrix[QuatLen][QuatLen]; extern Quat qOne; HMatrix *Qt_ToMatrix(Quat q, HMatrix out); Quat Qt_Conj(Quat q); Quat Qt_Mul(Quat qL, Quat qR); Quat Matrix_to_Qt(HMatrix dircos); HVect V3_(float x, float y, float z); float V3_Norm(HVect v); HVect V3_Unit(HVect v); HVect V3_Scale(HVect v, float s); HVect V3_Negate(HVect v); HVect V3_Sub(HVect v1, HVect v2); float V3_Dot(HVect v1, HVect v2); HVect V3_Cross(HVect v1, HVect v2); HVect V3_Bisect(HVect v0, HVect v1); #endif