You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vector3d.h 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef VECTOR3D_H
  2. #define VECTOR3D_H
  3. #include <QDebug>
  4. class Vector3D
  5. {
  6. public:
  7. explicit Vector3D(double x = 0.0, double y = 0.0, double z = 0.0);
  8. Vector3D(const Vector3D& other);
  9. virtual ~Vector3D();
  10. double getX() const;
  11. Vector3D& setX(double x);
  12. double getY() const;
  13. Vector3D& setY(double y);
  14. double getZ() const;
  15. Vector3D& setZ(double z);
  16. bool isNull() const;
  17. bool equal(const Vector3D& other) const;
  18. Vector3D& add(double k);
  19. Vector3D& add(double x, double y, double z);
  20. Vector3D& add(const Vector3D& other);
  21. Vector3D& sub(double k);
  22. Vector3D& sub(double x, double y, double z);
  23. Vector3D& sub(const Vector3D& other);
  24. Vector3D& mult(double k);
  25. Vector3D& div(double k);
  26. double dotProduct(double x, double y, double z) const;
  27. double dotProduct(const Vector3D& other) const;
  28. double norm() const;
  29. Vector3D operator+();
  30. Vector3D operator+(const double& k);
  31. Vector3D& operator+=(const double& k);
  32. Vector3D operator+(const Vector3D& other);
  33. Vector3D& operator+=(const Vector3D& other);
  34. Vector3D operator-();
  35. Vector3D operator-(const double& k);
  36. Vector3D& operator-=(const double& k);
  37. Vector3D operator-(const Vector3D& other);
  38. Vector3D& operator-=(const Vector3D& other);
  39. Vector3D operator*(const double& k);
  40. Vector3D& operator*=(const double& k);
  41. double operator*(const Vector3D& other);
  42. Vector3D& operator*=(const Vector3D& other);
  43. Vector3D operator/(const double& k);
  44. Vector3D& operator/=(const double& k);
  45. bool operator==(const Vector3D& other);
  46. bool operator!=(const Vector3D& other);
  47. bool operator!();
  48. operator bool();
  49. private:
  50. double _x;
  51. double _y;
  52. double _z;
  53. };
  54. QDebug operator<<(QDebug dbg, const Vector3D& v);
  55. #endif // VECTOR3D_H