Vector3D.h 1.1 KB

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