diff options
Diffstat (limited to 'src/vector.h')
| -rw-r--r-- | src/vector.h | 18 |
1 files changed, 18 insertions, 0 deletions
| diff --git a/src/vector.h b/src/vector.h index c207dc8..ed20936 100644 --- a/src/vector.h +++ b/src/vector.h | |||
| @@ -112,11 +112,29 @@ public: | |||
| 112 | return vec2(x() * other.x(), y() * other.y()); | 112 | return vec2(x() * other.x(), y() * other.y()); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | vec2& operator/=(T s) | ||
| 116 | { | ||
| 117 | x() /= s; | ||
| 118 | y() /= s; | ||
| 119 | |||
| 120 | return *this; | ||
| 121 | } | ||
| 122 | |||
| 123 | constexpr vec2 operator/(const vec2& other) const | ||
| 124 | { | ||
| 125 | return vec2(x() / other.x(), y() / other.y()); | ||
| 126 | } | ||
| 127 | |||
| 115 | constexpr bool operator==(const vec2& other) const | 128 | constexpr bool operator==(const vec2& other) const |
| 116 | { | 129 | { |
| 117 | return (x() == other.x()) && (y() == other.y()); | 130 | return (x() == other.x()) && (y() == other.y()); |
| 118 | } | 131 | } |
| 119 | 132 | ||
| 133 | constexpr bool operator!=(const vec2& other) const | ||
| 134 | { | ||
| 135 | return !(*this == other); | ||
| 136 | } | ||
| 137 | |||
| 120 | }; | 138 | }; |
| 121 | 139 | ||
| 122 | using vec2s = vec2<size_t>; | 140 | using vec2s = vec2<size_t>; |
