summaryrefslogtreecommitdiffhomepage
path: root/src/path-search-bbox.hpp
blob: 05ed726d091ef891041f5fcd2189a244dba5b896 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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