blob: e0ac3d43fef96afd39723cfcce3f8cc118846cd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "Vector2.h"
namespace crepe {
template <class T>
Vector2<T> Vector2<T>::operator-(const Vector2<T> & other) const { return {x - other.x, y - other.y}; }
template <class T>
Vector2<T> Vector2<T>::operator+(const Vector2<T> & other) const { return {x + other.x, y + other.y}; }
template <class T>
Vector2<T> Vector2<T>::operator*(double scalar) const { return {x * scalar, y * scalar}; }
template <class T>
Vector2<T> & Vector2<T>::operator*=(const Vector2<T> & other) {
x *= other.x;
y *= other.y;
return *this;
}
template <class T>
Vector2<T> & Vector2<T>::operator+=(const Vector2<T> & other) {
x += other.x;
y += other.y;
return *this;
}
template <class T>
Vector2<T> & Vector2<T>::operator+=(double other) {
x += other;
y += other;
return *this;
}
template <class T>
Vector2<T> Vector2<T>::operator-() const { return {-x, -y}; }
template <class T>
bool Vector2<T>::operator==(const Vector2<T> & other) const { return x == other.x && y == other.y; }
template <class T>
bool Vector2<T>::operator!=(const Vector2<T> & other) const { return !(*this == other); }
} // namespace crepe
|