diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 15:54:41 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 15:54:41 -0400 |
commit | 8ddab49cc13d809ca75dcd7f645661a3d3cb05c4 (patch) | |
tree | ba1e5f3237dbb7cdc939c35e193f5e6e46845a77 /vendor/quadtree/Vector2.h | |
parent | ac38dd0a5c394eefc39b7a8cf7b96762f18c8b31 (diff) | |
parent | 6f5287b3921c843a6b322ccbdfcbef00a8f16980 (diff) | |
download | lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.tar.gz lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.tar.bz2 lingo-ap-tracker-8ddab49cc13d809ca75dcd7f645661a3d3cb05c4.zip |
Merge branch 'subway'
Diffstat (limited to 'vendor/quadtree/Vector2.h')
-rw-r--r-- | vendor/quadtree/Vector2.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vendor/quadtree/Vector2.h b/vendor/quadtree/Vector2.h new file mode 100644 index 0000000..302d73e --- /dev/null +++ b/vendor/quadtree/Vector2.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #pragma once | ||
2 | |||
3 | namespace quadtree | ||
4 | { | ||
5 | |||
6 | template<typename T> | ||
7 | class Vector2 | ||
8 | { | ||
9 | public: | ||
10 | T x; | ||
11 | T y; | ||
12 | |||
13 | constexpr Vector2<T>(T X = 0, T Y = 0) noexcept : x(X), y(Y) | ||
14 | { | ||
15 | |||
16 | } | ||
17 | |||
18 | constexpr Vector2<T>& operator+=(const Vector2<T>& other) noexcept | ||
19 | { | ||
20 | x += other.x; | ||
21 | y += other.y; | ||
22 | return *this; | ||
23 | } | ||
24 | |||
25 | constexpr Vector2<T>& operator/=(T t) noexcept | ||
26 | { | ||
27 | x /= t; | ||
28 | y /= t; | ||
29 | return *this; | ||
30 | } | ||
31 | }; | ||
32 | |||
33 | template<typename T> | ||
34 | constexpr Vector2<T> operator+(Vector2<T> lhs, const Vector2<T>& rhs) noexcept | ||
35 | { | ||
36 | lhs += rhs; | ||
37 | return lhs; | ||
38 | } | ||
39 | |||
40 | template<typename T> | ||
41 | constexpr Vector2<T> operator/(Vector2<T> vec, T t) noexcept | ||
42 | { | ||
43 | vec /= t; | ||
44 | return vec; | ||
45 | } | ||
46 | |||
47 | } | ||