Vector.h 732 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. Vec3f cross(const Vec3f &other);
  26. };
  27. class Vec2f
  28. {
  29. public:
  30. union
  31. {
  32. struct
  33. {
  34. float x, y;
  35. };
  36. float v[2];
  37. };
  38. Vec2f();
  39. Vec2f(float x, float y);
  40. Vec2f(const Vec2f &other);
  41. float& operator [](int);
  42. Vec2f operator + (const Vec2f &other);
  43. float length();
  44. };