Vector.h 771 B

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