aboutsummaryrefslogtreecommitdiff
path: root/src/shared/math/coords.hh
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
commite4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch)
treeed58c3c246e3af1af337697695d780aa31f6ad9a /src/shared/math/coords.hh
parent1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff)
Update to most recent version (old initial commit)
Diffstat (limited to 'src/shared/math/coords.hh')
-rw-r--r--src/shared/math/coords.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/shared/math/coords.hh b/src/shared/math/coords.hh
new file mode 100644
index 0000000..7a21bf9
--- /dev/null
+++ b/src/shared/math/coords.hh
@@ -0,0 +1,31 @@
+#ifndef SHARED_MATH_COORDS_HH_
+#define SHARED_MATH_COORDS_HH_
+
+#include <compare>
+#include <cstdint>
+
+namespace shared {
+namespace math {
+
+// 2D coordinates.
+struct coords {
+public:
+ std::int32_t x;
+ std::int32_t z;
+
+public:
+ static bool is_inside_draw(const coords& a, const coords& b,
+ const std::int32_t draw_distance) noexcept;
+
+public:
+ coords operator+(const coords& c) const noexcept;
+ coords operator-(const coords& c) const noexcept;
+
+public:
+ auto operator<=>(const coords&) const noexcept = default;
+};
+
+} // namespace math
+} // namespace shared
+
+#endif