Vector.h 626 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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(Vec3f &other);
  15. Vec3f(float x, float y, float z);
  16. float Length();
  17. float Distance(const Vec3f &);
  18. float& operator [](int);
  19. Vec3f operator + (const Vec3f &other);
  20. Vec3f operator / (float value);
  21. bool operator ==(const Vec3f &other);
  22. bool operator !=(const Vec3f &other);
  23. };
  24. class Vec2f
  25. {
  26. public:
  27. union
  28. {
  29. struct
  30. {
  31. float x, y;
  32. };
  33. float v[2];
  34. };
  35. Vec2f();
  36. Vec2f(float x, float y);
  37. Vec2f(Vec2f &other);
  38. float& operator [](int);
  39. Vec2f operator + (const Vec2f &other);
  40. float length();
  41. };