From e4483eca01b48b943cd0461e24a74ae1a3139ed4 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 12 Feb 2025 21:57:46 +1100 Subject: Update to most recent version (old initial commit) --- src/shared/math/coords.hh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/shared/math/coords.hh (limited to 'src/shared/math/coords.hh') 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 +#include + +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 -- cgit v1.2.3