vector3.h - Engine C API Reference

vector3.h
  1. #pragma once
  2. #include "platform.h"
  3. #include "types.h"
  4. namespace stingray_plugin_foundation {
  5. // Operators
  6. __forceinline Vector3 operator / (const Vector3 &lhs, const Vector3 &rhs);
  7. __forceinline Vector3 operator * (const Vector3 &lhs, const Vector3 &rhs);
  8. __forceinline Vector3 operator + (const Vector3 &lhs, const Vector3 &rhs);
  9. __forceinline Vector3 operator - (const Vector3 &lhs, const Vector3 &rhs);
  10. __forceinline void operator /= (Vector3 &lhs, const Vector3 &rhs);
  11. __forceinline void operator *= (Vector3 &lhs, const Vector3 &rhs);
  12. __forceinline void operator += (Vector3 &lhs, const Vector3 &rhs);
  13. __forceinline void operator -= (Vector3 &lhs, const Vector3 &rhs);
  14. __forceinline Vector3 operator - (const Vector3 &v);
  15. __forceinline Vector3 operator + (const Vector3 &v);
  16. __forceinline Vector3 operator / (const Vector3 &lhs, float rhs);
  17. __forceinline Vector3 operator * (const Vector3 &lhs, float rhs);
  18. __forceinline Vector3 operator * (float lhs, const Vector3 &rhs);
  19. __forceinline Vector3 operator + (const Vector3 &lhs, float rhs);
  20. __forceinline Vector3 operator - (const Vector3 &lhs, float rhs);
  21. __forceinline void operator /= (Vector3 &lhs, float rhs);
  22. __forceinline void operator *= (Vector3 &lhs, float rhs);
  23. __forceinline void operator += (Vector3 &lhs, float rhs);
  24. __forceinline void operator -= (Vector3 &lhs, float rhs);
  25. __forceinline bool operator==(const Vector3 &lhs, const Vector3 &rhs);
  26. __forceinline bool operator!=(const Vector3 &lhs, const Vector3 &rhs);
  27. __forceinline bool operator< (const Vector3 &lhs, const Vector3 &rhs);
  28. __forceinline bool operator<=(const Vector3 &lhs, const Vector3 &rhs);
  29. __forceinline bool operator> (const Vector3 &lhs, const Vector3 &rhs);
  30. __forceinline bool operator>=(const Vector3 &lhs, const Vector3 &rhs);
  31. // Methods
  32. __forceinline Vector3 vector3(float x, float y, float z);
  33. __forceinline Vector3 vector3(const float v[3]);
  34. __forceinline Vector3 vector3(const Vector2 &v);
  35. __forceinline Vector3 vector3_base(int i);
  36. __forceinline float & element(Vector3 &m, int i);
  37. __forceinline const float & element(const Vector3 &m, int i);
  38. __forceinline bool all_gt(const Vector3& p1, const Vector3& p2);
  39. __forceinline bool all_lt(const Vector3& p1, const Vector3& p2);
  40. __forceinline void zero(Vector3 &v);
  41. __forceinline bool is_zero(const Vector3 &v);
  42. __forceinline bool is_zero(const Vector3 &v, float eps);
  43. __forceinline float length(const Vector3 &v);
  44. __forceinline float length_squared(const Vector3 &v);
  45. __forceinline float norm(const Vector3 &v);
  46. __forceinline float one_norm(const Vector3 &v);
  47. __forceinline float infinity_norm(const Vector3 &v);
  48. __forceinline Vector3 normalize(const Vector3 &v);
  49. __forceinline float dot(const Vector3 &v0, const Vector3 &v1);
  50. __forceinline Vector3 cross(const Vector3 &v0, const Vector3 &v1);
  51. __forceinline float distance(const Vector3 &v0, const Vector3 &v1);
  52. __forceinline float distance_squared(const Vector3 &v0, const Vector3 &v1);
  53. __forceinline Vector3 normal_vector(const Vector3 &v0,const Vector3 &v1, const Vector3& v2);
  54. __forceinline Vector3 min(const Vector3 &v0, const Vector3 &v1);
  55. __forceinline Vector3 max(const Vector3 &v0, const Vector3 &v1);
  56. // Makes v orthonormal with respect to ref and returns the result.
  57. __forceinline Vector3 orthonormalize(const Vector3 &v, const Vector3 &ref);
  58. // Given unit vector x finds two other axes y and z so that an orthonormal coordinate
  59. // system is formed.
  60. __forceinline void make_axes(const Vector3 &x, Vector3 &y, Vector3 &z);
  61. __forceinline Vector3 lerp(const Vector3 &a, const Vector3 &b, float t);
  62. struct MagnitudeAndDirection
  63. {
  64. float magnitude;
  65. Vector3 direction;
  66. };
  67. __forceinline MagnitudeAndDirection magnitude_and_direction(const Vector3 &v);
  68. }
  69. #include "vector3.inl"