Quaternion.h 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef QUATERNION_H
  2. #define QUATERNION_H
  3. #include "common/math/Vector.h"
  4. #include "client/math/Matrix.h"
  5. class Quaternion {
  6. public:
  7. Quaternion();
  8. Quaternion(const Vector3& axis, float angle);
  9. Quaternion lerp(float f, const Quaternion& other) const;
  10. Quaternion slerp(float f, const Quaternion& other) const;
  11. Quaternion squad(float f, const Quaternion& prev, const Quaternion& next, const Quaternion& nextNext) const;
  12. Matrix toMatrix() const;
  13. Quaternion& mul(const Quaternion& other);
  14. private:
  15. Quaternion(float x, float y, float z, float w);
  16. Quaternion interpolate(float a, float b, const Quaternion& other) const;
  17. Quaternion& normalize();
  18. Quaternion squadControl(const Quaternion& prev, const Quaternion& next) const;
  19. Quaternion& conjugate();
  20. Quaternion& log();
  21. Quaternion& exp();
  22. Quaternion& mul(float f);
  23. Quaternion& add(const Quaternion& other);
  24. Vector3 xyz;
  25. float w;
  26. };
  27. #endif