return const refs + vec constantize

This commit is contained in:
vaxerski
2022-04-23 14:40:51 +02:00
parent 77002eeea0
commit 306d163613
2 changed files with 12 additions and 12 deletions

View File

@@ -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;
}