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.7KB

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