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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. double getX() const;
  9. Vector3D& setX(double x);
  10. double getY() const;
  11. Vector3D& setY(double y);
  12. double getZ() const;
  13. Vector3D& setZ(double z);
  14. bool isNull() const;
  15. bool equal(const Vector3D& other) const;
  16. Vector3D& add(double k);
  17. Vector3D& add(double x, double y, double z);
  18. Vector3D& add(const Vector3D& other);
  19. Vector3D& sub(double k);
  20. Vector3D& sub(double x, double y, double z);
  21. Vector3D& sub(const Vector3D& other);
  22. Vector3D& mult(double k);
  23. Vector3D& div(double k);
  24. double dotProduct(double x, double y, double z) const;
  25. double dotProduct(const Vector3D& other) const;
  26. double norm() const;
  27. Vector3D operator+();
  28. Vector3D operator+(const double& k);
  29. Vector3D& operator+=(const double& k);
  30. Vector3D operator+(const Vector3D& other);
  31. Vector3D& operator+=(const Vector3D& other);
  32. Vector3D operator-();
  33. Vector3D operator-(const double& k);
  34. Vector3D& operator-=(const double& k);
  35. Vector3D operator-(const Vector3D& other);
  36. Vector3D& operator-=(const Vector3D& other);
  37. Vector3D operator*(const double& k);
  38. Vector3D& operator*=(const double& k);
  39. double operator*(const Vector3D& other);
  40. Vector3D& operator*=(const Vector3D& other);
  41. Vector3D operator/(const double& k);
  42. Vector3D& operator/=(const double& k);
  43. bool operator==(const Vector3D& other);
  44. bool operator!=(const Vector3D& other);
  45. bool operator!();
  46. operator bool();
  47. private:
  48. double _x;
  49. double _y;
  50. double _z;
  51. };
  52. #endif // VECTOR3D_H