Vector2.pkg 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. $#include "Vector2.h"
  2. class Vector2
  3. {
  4. Vector2();
  5. Vector2(const Vector2& vector);
  6. Vector2(float x, float y);
  7. ~Vector2();
  8. bool operator == (const Vector2& rhs) const;
  9. Vector2 operator + (const Vector2& rhs) const;
  10. Vector2 operator - () const;
  11. Vector2 operator - (const Vector2& rhs) const;
  12. Vector2 operator * (float rhs) const;
  13. Vector2 operator * (const Vector2& rhs) const;
  14. Vector2 operator / (float rhs) const;
  15. Vector2 operator / (const Vector2& rhs) const;
  16. Vector2 operator / (const Vector2& rhs) const;
  17. void Normalize();
  18. float Length() const;
  19. float LengthSquared() const;
  20. float DotProduct(const Vector2& rhs) const;
  21. float AbsDotProduct(const Vector2& rhs) const;
  22. Vector2 Abs() const;
  23. Vector2 Lerp(const Vector2& rhs, float t) const;
  24. bool Equals(const Vector2& rhs) const;
  25. bool IsNaN() const;
  26. Vector2 Normalized() const;
  27. String ToString() const;
  28. float x_ @ x;
  29. float y_ @ y;
  30. static const Vector2 ZERO;
  31. static const Vector2 LEFT;
  32. static const Vector2 RIGHT;
  33. static const Vector2 UP;
  34. static const Vector2 DOWN;
  35. static const Vector2 ONE;
  36. };
  37. class IntVector2
  38. {
  39. IntVector2();
  40. IntVector2(int x, int y);
  41. IntVector2(const IntVector2& rhs);
  42. ~IntVector2();
  43. bool operator == (const IntVector2& rhs) const;
  44. IntVector2 operator + (const IntVector2& rhs) const;
  45. IntVector2 operator - () const;
  46. IntVector2 operator - (const IntVector2& rhs) const;
  47. IntVector2 operator * (int rhs) const;
  48. IntVector2 operator / (int rhs) const;
  49. IntVector2 operator / (int rhs) const;
  50. String ToString() const;
  51. int x_ @ x;
  52. int y_ @ y;
  53. static const IntVector2 ZERO;
  54. };