BallAux.h 706 B

12345678910111213141516171819202122232425262728293031
  1. /***** BallAux.h - Vector and quaternion routines for Arcball. *****/
  2. #ifndef _H_BallAux
  3. #define _H_BallAux
  4. typedef struct
  5. {
  6. float x, y, z, w;
  7. } Quat;
  8. enum QuatPart
  9. { XX, YY, ZZ, WW, QuatLen };
  10. typedef Quat HVect;
  11. typedef float HMatrix[QuatLen][QuatLen];
  12. extern Quat qOne;
  13. HMatrix *Qt_ToMatrix(Quat q, HMatrix out);
  14. Quat Qt_Conj(Quat q);
  15. Quat Qt_Mul(Quat qL, Quat qR);
  16. Quat Matrix_to_Qt(HMatrix dircos);
  17. HVect V3_(float x, float y, float z);
  18. float V3_Norm(HVect v);
  19. HVect V3_Unit(HVect v);
  20. HVect V3_Scale(HVect v, float s);
  21. HVect V3_Negate(HVect v);
  22. HVect V3_Sub(HVect v1, HVect v2);
  23. float V3_Dot(HVect v1, HVect v2);
  24. HVect V3_Cross(HVect v1, HVect v2);
  25. HVect V3_Bisect(HVect v0, HVect v1);
  26. #endif