Vector.h 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef VECTOR_H
  2. #define VECTOR_H
  3. #include <iostream>
  4. class Vector final
  5. {
  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 addMul(const Vector& v, float f);
  23. void cross(float ix, float iy, float iz);
  24. void cross(const Vector& v);
  25. void normalize();
  26. float squareLength() const;
  27. float dot(const Vector& v) const;
  28. float dotInverse(const Vector& v) const;
  29. private:
  30. float x;
  31. float y;
  32. float z;
  33. };
  34. std::ostream& operator<<(std::ostream& os, const Vector& v);
  35. #endif