diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-24 05:16:58 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-24 05:16:58 +0100 |
| commit | db09342af865ac5df7d4c35f25115ed39fbd0ddd (patch) | |
| tree | 06216a603a8d1629c690e8dd6ef0ce06eae965cd /src/path-search-bbox.hpp | |
| parent | ee2f8ee5e5d4e97d7dcaaaf2d7753d1fb6deeadd (diff) | |
src: split bbox into its own header
Diffstat (limited to 'src/path-search-bbox.hpp')
| -rw-r--r-- | src/path-search-bbox.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/path-search-bbox.hpp b/src/path-search-bbox.hpp new file mode 100644 index 00000000..05ed726d --- /dev/null +++ b/src/path-search-bbox.hpp @@ -0,0 +1,25 @@ +#pragma once +#include "path-search.hpp" +#include <concepts> +#include <Magnum/Math/Vector2.h> +#include <Magnum/DimensionTraits.h> + +namespace floormat::detail_astar { + +template<typename T> struct bbox +{ + static_assert(std::is_arithmetic_v<T>); + + VectorTypeFor<2, T> min, max; + + constexpr bool operator==(const bbox<T>&) const = default; + + template<typename U> + requires std::is_arithmetic_v<U> + explicit constexpr operator bbox<U>() const { + using Vec = VectorTypeFor<2, U>; + return bbox<U>{ Vec(min), Vec(max) }; + } +}; + +} // namespace floormat::detail_astar |
