Quat.hpp 1.8 KB

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