Vector3.pkg 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 CrossProduct(const Vector3& rhs) const;
  27. Vector3 Abs() const;
  28. Vector3 Lerp(const Vector3& rhs, float t) const;
  29. bool Equals(const Vector3& rhs) const;
  30. bool IsNaN() const;
  31. float Angle(const Vector3& rhs) const;
  32. Vector3 Normalized() const;
  33. String ToString() const;
  34. float x_ @ x;
  35. float y_ @ y;
  36. float z_ @ z;
  37. static const Vector3 ZERO;
  38. static const Vector3 LEFT;
  39. static const Vector3 RIGHT;
  40. static const Vector3 UP;
  41. static const Vector3 DOWN;
  42. static const Vector3 FORWARD;
  43. static const Vector3 BACK;
  44. static const Vector3 ONE;
  45. };
  46. class IntVector3
  47. {
  48. IntVector3();
  49. IntVector3(int x, int y, int z);
  50. IntVector3(const IntVector3& rhs);
  51. ~IntVector3();
  52. bool operator ==(const IntVector3& rhs) const;
  53. IntVector3 operator + (const IntVector3& rhs) const;
  54. IntVector3 operator - () const;
  55. IntVector3 operator - (const IntVector3& rhs) const;
  56. IntVector3 operator * (int rhs) const;
  57. IntVector3 operator / (int rhs) const;
  58. String ToString() const;
  59. unsigned ToHash() const;
  60. float Length() const;
  61. int x_ @ x;
  62. int y_ @ y;
  63. int z_ @ z;
  64. static const IntVector3 ZERO;
  65. static const IntVector3 LEFT;
  66. static const IntVector3 RIGHT;
  67. static const IntVector3 UP;
  68. static const IntVector3 DOWN;
  69. static const IntVector3 FORWARD;
  70. static const IntVector3 BACK;
  71. static const IntVector3 ONE;
  72. };
  73. Vector3 VectorLerp(const Vector3& lhs, const Vector3& rhs, const Vector3& t);
  74. Vector3 VectorMin(const Vector3& lhs, const Vector3& rhs);
  75. Vector3 VectorMax(const Vector3& lhs, const Vector3& rhs);
  76. Vector3 VectorFloor(const Vector3& vec);
  77. Vector3 VectorRound(const Vector3& vec);
  78. Vector3 VectorCeil(const Vector3& vec);
  79. IntVector3 VectorFloorToInt(const Vector3& vec);
  80. IntVector3 VectorRoundToInt(const Vector3& vec);
  81. IntVector3 VectorCeilToInt(const Vector3& vec);
  82. IntVector3 VectorMin(const IntVector3& lhs, const IntVector3& rhs);
  83. IntVector3 VectorMax(const IntVector3& lhs, const IntVector3& rhs);
  84. float StableRandom(const Vector3& seed);