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 882B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef VECTOR3D_H
  2. #define VECTOR3D_H
  3. class Vector3D
  4. {
  5. public:
  6. 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. Vector3D& add(double x, double y, double z);
  16. Vector3D& add(const Vector3D& other);
  17. Vector3D& sub(double x, double y, double z);
  18. Vector3D& sub(const Vector3D& other);
  19. Vector3D& mult(double k);
  20. Vector3D& div(double k);
  21. double dotProduct(double x, double y, double z) const;
  22. double dotProduct(const Vector3D& other) const;
  23. double norm() const;
  24. private:
  25. double _x;
  26. double _y;
  27. double _z;
  28. };
  29. Vector3D& operator+(const Vector3D& v1, const Vector3D& v2);
  30. #endif // VECTOR3D_H