Vector.h 1006 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. void setX(float ix);
  13. void setY(float iy);
  14. void setZ(float iz);
  15. void set(float ix, float iy, float iz);
  16. void setInverse(const Vector& v);
  17. void setMul(const Vector& v, float f);
  18. void setAngles(float lengthAngle, float widthAngle);
  19. void add(const Vector& v);
  20. void sub(const Vector& v);
  21. void mul(float f);
  22. void mul(const Matrix& m);
  23. void addMul(const Vector& v, float f);
  24. void cross(float ix, float iy, float iz);
  25. void cross(const Vector& v);
  26. void normalize();
  27. float squareLength() const;
  28. float dot(const Vector& v) const;
  29. float dotInverse(const Vector& v) const;
  30. private:
  31. float x;
  32. float y;
  33. float z;
  34. };
  35. std::ostream& operator<<(std::ostream& os, const Vector& v);
  36. #endif