quaternion.h - Engine C API Reference

quaternion.h
  1. #pragma once
  2. #include "platform.h"
  3. #include "types.h"
  4. namespace stingray_plugin_foundation {
  5. // Operators
  6. __forceinline Quaternion operator +(const Quaternion &q);
  7. __forceinline Quaternion operator -(const Quaternion &q);
  8. __forceinline Quaternion operator +(const Quaternion &lhs, const Quaternion &rhs);
  9. __forceinline Quaternion operator -(const Quaternion &lhs, const Quaternion &rhs);
  10. __forceinline Quaternion operator *(const Quaternion &lhs, const Quaternion &rhs);
  11. __forceinline Quaternion operator *(const Quaternion &lhs, float rhs);
  12. __forceinline Quaternion operator *(float lhs, const Quaternion &rhs);
  13. __forceinline Quaternion operator /(const Quaternion &lhs, float rhs);
  14. __forceinline void operator +=(Quaternion &lhs, const Quaternion &rhs);
  15. __forceinline void operator -=(Quaternion &lhs, const Quaternion &rhs);
  16. __forceinline void operator *=(Quaternion &lhs, const Quaternion &rhs);
  17. __forceinline void operator *=(Quaternion &lhs, float rhs);
  18. __forceinline bool operator==(const Quaternion &lhs, const Quaternion &rhs);
  19. __forceinline bool operator!=(const Quaternion &lhs, const Quaternion &rhs);
  20. __forceinline bool operator< (const Quaternion &lhs, const Quaternion &rhs);
  21. __forceinline bool operator<=(const Quaternion &lhs, const Quaternion &rhs);
  22. __forceinline bool operator> (const Quaternion &lhs, const Quaternion &rhs);
  23. __forceinline bool operator>=(const Quaternion &lhs, const Quaternion &rhs);
  24. // Creation Methods
  25. __forceinline Quaternion quaternion(const float * list);
  26. __forceinline Quaternion quaternion(float x, float y, float z, float w);
  27. __forceinline const Quaternion &quaternion_identity();
  28. __forceinline Quaternion quaternion(const Vector3 &axis, float theta);
  29. Quaternion quaternion(const Vector3 &forward, const Vector3 &up);
  30. Quaternion quaternion(const Matrix4x4 &m);
  31. Quaternion quaternion(const Matrix3x3 &m);
  32. Quaternion quaternion_orthogonal(const Matrix4x4 &m);
  33. // Methods
  34. __forceinline Quaternion normalize(const Quaternion &q);
  35. __forceinline Quaternion inverse(const Quaternion &q);
  36. __forceinline Quaternion conjugate(const Quaternion &q);
  37. __forceinline float dot(const Quaternion &q1, const Quaternion &q2);
  38. __forceinline Quaternion slerp(const Quaternion &from, const Quaternion &to, float t);
  39. __forceinline Quaternion nlerp(const Quaternion &from, const Quaternion &to, float t);
  40. __forceinline Quaternion lerp(const Quaternion &from, const Quaternion &to, float t);
  41. __forceinline Quaternion scale_angle(const Quaternion &from, float t);
  42. __forceinline bool is_zero(const Quaternion &q);
  43. __forceinline float norm(const Quaternion &q);
  44. __forceinline float one_norm(const Quaternion &q);
  45. __forceinline float infinity_norm(const Quaternion &q);
  46. // Rotate Vector3 with quaternion.
  47. __forceinline Vector3 rotate(const Quaternion &q, const Vector3 &v);
  48. // Conversion Methods
  49. __forceinline Matrix4x4 matrix4x4(const Quaternion &q);
  50. __forceinline Matrix4x4 matrix4x4(const Quaternion &q, const Vector3 &p);
  51. __forceinline void decompose(const Quaternion &q, Vector3 *axis, float *theta);
  52. __forceinline float angle(const Quaternion &q);
  53. // Lerps the matrix by lerping Quaternion and Vector3 separately.
  54. __forceinline void lerp(const Matrix4x4 &m1, const Matrix4x4 &m2, float t, Matrix4x4 &m);
  55. }
  56. #include "quaternion.inl"