Vector.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef VECTOR_H
  2. #define VECTOR_H
  3. #include "common/utils/String.h"
  4. #include "client/math/Matrix.h"
  5. class Vector final {
  6. public:
  7. Vector();
  8. Vector(float ix, float iy, float iz);
  9. Vector(float lengthAngle, float widthAngle);
  10. float getX() const;
  11. float getY() const;
  12. float getZ() const;
  13. Vector& setX(float ix);
  14. Vector& setY(float iy);
  15. Vector& setZ(float iz);
  16. Vector& set(const Vector& v);
  17. Vector& set(float ix, float iy, float iz);
  18. Vector& setInverse(const Vector& v);
  19. Vector& setMul(const Vector& v, float f);
  20. Vector& setAngles(float lengthAngle, float widthAngle);
  21. Vector& add(const Vector& v);
  22. Vector& sub(const Vector& v);
  23. Vector& mul(float f);
  24. Vector& mul(const Matrix& m);
  25. Vector& addMul(const Vector& v, float f);
  26. Vector& cross(float ix, float iy, float iz);
  27. Vector& cross(const Vector& v);
  28. Vector& normalize();
  29. float squareLength() const;
  30. float length() const;
  31. float dot(const Vector& v) const;
  32. float dotInverse(const Vector& v) const;
  33. void toString(String& s) const;
  34. private:
  35. float x;
  36. float y;
  37. float z;
  38. };
  39. #endif