Vector.h 696 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. class Vec3f
  3. {
  4. public:
  5. union
  6. {
  7. struct
  8. {
  9. float x, y, z;
  10. };
  11. float v[3];
  12. };
  13. Vec3f();
  14. Vec3f(const Vec3f &other);
  15. Vec3f(float x, float y, float z);
  16. float Length();
  17. void Normalize();
  18. float Distance(const Vec3f &);
  19. float& operator [](int);
  20. Vec3f operator + (const Vec3f &other);
  21. Vec3f operator -(const Vec3f &other);
  22. Vec3f operator / (float value);
  23. bool operator ==(const Vec3f &other);
  24. bool operator !=(const Vec3f &other);
  25. };
  26. class Vec2f
  27. {
  28. public:
  29. union
  30. {
  31. struct
  32. {
  33. float x, y;
  34. };
  35. float v[2];
  36. };
  37. Vec2f();
  38. Vec2f(float x, float y);
  39. Vec2f(const Vec2f &other);
  40. float& operator [](int);
  41. Vec2f operator + (const Vec2f &other);
  42. float length();
  43. };