Vector.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef VECTOR_H
  2. #define VECTOR_H
  3. #include <iostream>
  4. #include "client/math/Matrix.h"
  5. class Vector final
  6. {
  7. public:
  8. Vector();
  9. Vector(float ix, float iy, float iz);
  10. float getX() const;
  11. float getY() const;
  12. float getZ() const;
  13. void setX(float ix);
  14. void setY(float iy);
  15. void setZ(float iz);
  16. void set(float ix, float iy, float iz);
  17. void setInverse(const Vector& v);
  18. void setMul(const Vector& v, float f);
  19. void setAngles(float lengthAngle, float widthAngle);
  20. void add(const Vector& v);
  21. void sub(const Vector& v);
  22. void mul(float f);
  23. void mul(const Matrix& m);
  24. void addMul(const Vector& v, float f);
  25. void cross(float ix, float iy, float iz);
  26. void cross(const Vector& v);
  27. void 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