about summary refs log tree commit diff stats
path: root/vendor/quadtree/Vector2.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-06-09 22:43:20 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-06-09 22:43:20 -0400
commit475b7a38f66071ad5713f6f00a49c4e1399e0613 (patch)
tree4dcb76d5bb9e1dbabe19dcbd0cc9676c31f715e6 /vendor/quadtree/Vector2.h
parent829bb6ba7fdbef5c4e6fb9e4eabc0c2f962325ae (diff)
parent14d075e02007aeb53dbadd6c629564ee467cd7b2 (diff)
downloadlingo-ap-tracker-475b7a38f66071ad5713f6f00a49c4e1399e0613.tar.gz
lingo-ap-tracker-475b7a38f66071ad5713f6f00a49c4e1399e0613.tar.bz2
lingo-ap-tracker-475b7a38f66071ad5713f6f00a49c4e1399e0613.zip
Merge branch 'main' into panels
Diffstat (limited to 'vendor/quadtree/Vector2.h')
-rw-r--r--vendor/quadtree/Vector2.h47
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
3namespace quadtree
4{
5
6template<typename T>
7class Vector2
8{
9public:
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
33template<typename T>
34constexpr Vector2<T> operator+(Vector2<T> lhs, const Vector2<T>& rhs) noexcept
35{
36 lhs += rhs;
37 return lhs;
38}
39
40template<typename T>
41constexpr Vector2<T> operator/(Vector2<T> vec, T t) noexcept
42{
43 vec /= t;
44 return vec;
45}
46
47}