Quat.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef QUAT_H
  2. #define QUAT_H
  3. #include <cmath>
  4. #include "Vector3.hpp"
  5. // #include "Basis.h"
  6. namespace godot {
  7. class Quat{
  8. public:
  9. real_t x,y,z,w;
  10. real_t length_squared() const;
  11. real_t length() const;
  12. void normalize();
  13. Quat normalized() const;
  14. Quat inverse() const;
  15. void set_euler(const Vector3& p_euler);
  16. real_t dot(const Quat& q) const;
  17. Vector3 get_euler() const;
  18. Quat slerp(const Quat& q, const real_t& t) const;
  19. Quat slerpni(const Quat& q, const real_t& t) const;
  20. Quat cubic_slerp(const Quat& q, const Quat& prep, const Quat& postq,const real_t& t) const;
  21. void get_axis_and_angle(Vector3& r_axis, real_t &r_angle) const;
  22. void operator*=(const Quat& q);
  23. Quat operator*(const Quat& q) const;
  24. Quat operator*(const Vector3& v) const;
  25. Vector3 xform(const Vector3& v) const;
  26. void operator+=(const Quat& q);
  27. void operator-=(const Quat& q);
  28. void operator*=(const real_t& s);
  29. void operator/=(const real_t& s);
  30. Quat operator+(const Quat& q2) const;
  31. Quat operator-(const Quat& q2) const;
  32. Quat operator-() const;
  33. Quat operator*(const real_t& s) const;
  34. Quat operator/(const real_t& s) const;
  35. bool operator==(const Quat& p_quat) const;
  36. bool operator!=(const Quat& p_quat) const;
  37. operator String() const;
  38. inline void set( real_t p_x, real_t p_y, real_t p_z, real_t p_w) {
  39. x=p_x; y=p_y; z=p_z; w=p_w;
  40. }
  41. inline Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) {
  42. x=p_x; y=p_y; z=p_z; w=p_w;
  43. }
  44. Quat(const Vector3& axis, const real_t& angle);
  45. Quat(const Vector3& v0, const Vector3& v1) ;
  46. inline Quat() {x=y=z=0; w=1; }
  47. };
  48. }
  49. #endif // QUAT_H