aboutsummaryrefslogtreecommitdiffstats
path: root/include/mapbox/geometry/box.hpp
blob: bf81b703ecd80bb70043dfba346287d88ce9d481 (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
26
27
28
29
30
31
32
33
34
#pragma once

#include <mapbox/geometry/point.hpp>

namespace mapbox {
namespace geometry {

template <typename T>
struct box
{
    using point_type = point<T>;

    constexpr box(point_type const& min_, point_type const& max_)
        : min(min_), max(max_)
    {}

    point_type min;
    point_type max;
};

template <typename T>
constexpr bool operator==(box<T> const& lhs, box<T> const& rhs)
{
    return lhs.min == rhs.min && lhs.max == rhs.max;
}

template <typename T>
constexpr bool operator!=(box<T> const& lhs, box<T> const& rhs)
{
    return lhs.min != rhs.min || lhs.max != rhs.max;
}

} // namespace geometry
} // namespace mapbox