123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include "vector2d.h"
-
-
- Vector2D::Vector2D(double x, double y)
- : VectorXD<2>()
- {
- _scalars[0] = x;
- _scalars[1] = y;
- }
-
- Vector2D::Vector2D(const Vector2D &other)
- : VectorXD<2>(other)
- {
- }
-
- Vector2D::Vector2D(const VectorXD<2> &other)
- : VectorXD<2>(other)
- {
- }
-
- Vector2D::~Vector2D()
- {
- }
-
- double Vector2D::getX() const
- {
- return _scalars[0];
- }
-
- Vector2D& Vector2D::setX(double x)
- {
- _scalars[0] = x;
- return *this;
- }
- double Vector2D::getY() const
- {
- return _scalars[1];
- }
-
- Vector2D& Vector2D::setY(double y)
- {
- _scalars[1] = y;
- return *this;
- }
-
- Vector2D &Vector2D::add(double x, double y)
- {
- _scalars[0] += x;
- _scalars[1] += y;
- return *this;
- }
-
- Vector2D &Vector2D::sub(double x, double y)
- {
- _scalars[0] -= x;
- _scalars[1] -= y;
- return *this;
- }
-
- double Vector2D::dotProduct(double x, double y) const
- {
- return dotProduct(Vector2D(x, y));
- }
|