Vector3.pkg 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. $#include "Math/Vector3.h"
  2. class Vector3
  3. {
  4. Vector3();
  5. Vector3(const Vector3& vector);
  6. Vector3(const Vector2& vector, float z);
  7. Vector3(const Vector2& vector);
  8. Vector3(const IntVector3& vector);
  9. Vector3(float x, float y, float z);
  10. Vector3(float x, float y);
  11. ~Vector3();
  12. bool operator ==(const Vector3& rhs) const;
  13. Vector3 operator + (const Vector3& rhs) const;
  14. Vector3 operator - () const;
  15. Vector3 operator - (const Vector3& rhs) const;
  16. Vector3 operator * (float rhs) const;
  17. Vector3 operator * (const Vector3& rhs) const;
  18. Vector3 operator / (float rhs) const;
  19. Vector3 operator / (const Vector3& rhs) const;
  20. void Normalize();
  21. float Length() const;
  22. float LengthSquared() const;
  23. float DotProduct(const Vector3& rhs) const;
  24. float AbsDotProduct(const Vector3& rhs) const;
  25. float ProjectOntoAxis(const Vector3& axis) const;
  26. Vector3 Orthogonalize(const Vector3& axis) const;
  27. Vector3 CrossProduct(const Vector3& rhs) const;
  28. Vector3 Abs() const;
  29. Vector3 Lerp(const Vector3& rhs, float t) const;
  30. bool Equals(const Vector3& rhs) const;
  31. bool IsNaN() const;
  32. float Angle(const Vector3& rhs) const;
  33. Vector3 Normalized() const;
  34. String ToString() const;
  35. float x_ @ x;
  36. float y_ @ y;
  37. float z_ @ z;
  38. static const Vector3 ZERO;
  39. static const Vector3 LEFT;
  40. static const Vector3 RIGHT;
  41. static const Vector3 UP;
  42. static const Vector3 DOWN;
  43. static const Vector3 FORWARD;
  44. static const Vector3 BACK;
  45. static const Vector3 ONE;
  46. };
  47. class IntVector3
  48. {
  49. IntVector3();
  50. IntVector3(int x, int y, int z);
  51. IntVector3(const IntVector3& rhs);
  52. ~IntVector3();
  53. bool operator ==(const IntVector3& rhs) const;
  54. IntVector3 operator + (const IntVector3& rhs) const;
  55. IntVector3 operator - () const;
  56. IntVector3 operator - (const IntVector3& rhs) const;
  57. IntVector3 operator * (int rhs) const;
  58. IntVector3 operator / (int rhs) const;
  59. String ToString() const;
  60. unsigned ToHash() const;
  61. float Length() const;
  62. int x_ @ x;
  63. int y_ @ y;
  64. int z_ @ z;
  65. static const IntVector3 ZERO;
  66. static const IntVector3 LEFT;
  67. static const IntVector3 RIGHT;
  68. static const IntVector3 UP;
  69. static const IntVector3 DOWN;
  70. static const IntVector3 FORWARD;
  71. static const IntVector3 BACK;
  72. static const IntVector3 ONE;
  73. };
  74. Vector3 VectorLerp(const Vector3& lhs, const Vector3& rhs, const Vector3& t);
  75. Vector3 VectorMin(const Vector3& lhs, const Vector3& rhs);
  76. Vector3 VectorMax(const Vector3& lhs, const Vector3& rhs);
  77. Vector3 VectorFloor(const Vector3& vec);
  78. Vector3 VectorRound(const Vector3& vec);
  79. Vector3 VectorCeil(const Vector3& vec);
  80. IntVector3 VectorFloorToInt(const Vector3& vec);
  81. IntVector3 VectorRoundToInt(const Vector3& vec);
  82. IntVector3 VectorCeilToInt(const Vector3& vec);
  83. IntVector3 VectorMin(const IntVector3& lhs, const IntVector3& rhs);
  84. IntVector3 VectorMax(const IntVector3& lhs, const IntVector3& rhs);
  85. float StableRandom(const Vector3& seed);