diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-23 14:40:51 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-23 14:40:51 +0200 |
| commit | 306d163613c6940e73ad58e852b42cdb236a5bc4 (patch) | |
| tree | 95d550abf8fbd4c02f25687d8b9a4f96fbdc3520 /src/helpers/Vector2D.hpp | |
| parent | 77002eeea0d10661c2b90345bf6c5b9888afcff6 (diff) | |
return const refs + vec constantize
Diffstat (limited to 'src/helpers/Vector2D.hpp')
| -rw-r--r-- | src/helpers/Vector2D.hpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp index 5fe4ccd3..7288a088 100644 --- a/src/helpers/Vector2D.hpp +++ b/src/helpers/Vector2D.hpp @@ -14,24 +14,24 @@ class Vector2D { // returns the scale double normalize(); - Vector2D operator+(const Vector2D a) { + Vector2D operator+(const Vector2D a) const { return Vector2D(this->x + a.x, this->y + a.y); } - Vector2D operator-(const Vector2D a) { + Vector2D operator-(const Vector2D a) const { return Vector2D(this->x - a.x, this->y - a.y); } - Vector2D operator*(const float a) { + Vector2D operator*(const float a) const { return Vector2D(this->x * a, this->y * a); } - Vector2D operator/(const float a) { + Vector2D operator/(const float a) const { return Vector2D(this->x / a, this->y / a); } - bool operator==(const Vector2D& a) { + bool operator==(const Vector2D& a) const { return a.x == x && a.y == y; } - bool operator!=(const Vector2D& a) { + bool operator!=(const Vector2D& a) const { return a.x != x || a.y != y; } |
