Vector.h 1.1 KB

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