Quaternion.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef CORE_QUATERNION_H
  2. #define CORE_QUATERNION_H
  3. #include "core/Vector.h"
  4. typedef struct {
  5. CoreVector3 xyz;
  6. float w;
  7. } CoreQuaternion;
  8. #define CORE_UNIT_QUATERNION ((CoreQuaternion){{{0.0f, 0.0f, 0.0f}}, 1.0f})
  9. CoreQuaternion* coreAxisAngleQ(CoreQuaternion* q, const CoreVector3* axis,
  10. float angle);
  11. CoreQuaternion* coreLerpQ(CoreQuaternion* q, const CoreQuaternion* a, float f,
  12. const CoreQuaternion* b);
  13. CoreQuaternion* coreMulSetQ(CoreQuaternion* q, const CoreQuaternion* other);
  14. CoreQuaternion* coreMulQ(CoreQuaternion* q, const CoreQuaternion* a,
  15. const CoreQuaternion* b);
  16. CoreVector3* coreMulQV3(CoreVector3* r, const CoreQuaternion* q,
  17. const CoreVector3* v);
  18. size_t coreToStringQ(const CoreQuaternion* q, char* buffer, size_t n);
  19. #ifdef IMPORT_CORE
  20. #define Quaternion CoreQuaternion
  21. #define UNIT_QUATERNION CORE_UNIT_QUATERNION
  22. #define axisAngleQ coreAxisAngleQ
  23. #define lerpQ coreLerpQ
  24. #define mulSetQ coreMulSetQ
  25. #define mulQ coreMulQ
  26. #define mulQV3 coreMulQV3
  27. #define toStringQ coreToStringQ
  28. #endif
  29. #endif