summary refs log tree commit diff stats
path: root/src/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vector.h')
-rw-r--r--src/vector.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vector.h b/src/vector.h index 3abd98a..9355dd5 100644 --- a/src/vector.h +++ b/src/vector.h
@@ -7,9 +7,11 @@ public:
7 7
8 T coords[2]; 8 T coords[2];
9 9
10 vec2() = default; 10 vec2() : coords{0, 0}
11 {
12 }
11 13
12 vec2(double x, double y) : coords{x, y} 14 vec2(T x, T y) : coords{x, y}
13 { 15 {
14 } 16 }
15 17
@@ -90,12 +92,12 @@ public:
90 return vec2(-x(), -y()); 92 return vec2(-x(), -y());
91 } 93 }
92 94
93 vec2 operator*(double s) const 95 vec2 operator*(T s) const
94 { 96 {
95 return vec2(x() * s, y() * s); 97 return vec2(x() * s, y() * s);
96 } 98 }
97 99
98 vec2& operator*=(double s) 100 vec2& operator*=(T s)
99 { 101 {
100 x() *= s; 102 x() *= s;
101 y() *= s; 103 y() *= s;