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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 Vector3D& v2);
  30. Vector3D operator-();
  31. Vector3D operator-(const double& k);
  32. Vector3D operator-(const Vector3D& v2);
  33. Vector3D operator*(const double& k);
  34. double operator*(const Vector3D& v2);
  35. Vector3D operator/(const double& k);
  36. bool operator==(const Vector3D& other);
  37. bool operator!=(const Vector3D& other);
  38. bool operator!();
  39. operator bool();
  40. private:
  41. double _x;
  42. double _y;
  43. double _z;
  44. };
  45. #endif // VECTOR3D_H