UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
occupancy_interval.hpp
1
42#ifndef UFO_MAP_OCCUPANCY_PREDICATE_OCCUPANCY_INTERVAL_HPP
43#define UFO_MAP_OCCUPANCY_PREDICATE_OCCUPANCY_INTERVAL_HPP
44
45// UFO
46#include <ufo/container/tree/index.hpp>
47#include <ufo/container/tree/predicate/filter.hpp>
48#include <ufo/map/occupancy/predicate/occupancy.hpp>
49
50namespace ufo::pred
51{
52template <bool Negated = false>
54 using occupancy_t = float;
55
56 constexpr OccupancyInterval(occupancy_t min, occupancy_t max) : min(min), max(max) {}
57
60};
61
62template <bool Negated>
64{
65 return {p.min, p.max};
66}
67
68template <bool Negated>
69struct Filter<OccupancyInterval<Negated>>
70 : public FilterBase<OccupancyInterval<Negated>> {
72
73 template <class Tree>
74 static constexpr void init(Pred& p, Tree const& t)
75 {
76 init(p.min, t);
77 init(p.max, t);
78 }
79
80 template <class Tree>
81 [[nodiscard]] static constexpr bool returnable(Pred const& p, Tree const& t,
82 TreeIndex const& n)
83 {
84 if constexpr (Negated) {
85 return !valueCheck(p.min, t, n) && !valueCheck(p.max, t, n);
86 } else {
87 return valueCheck(p.min, t, n) && valueCheck(p.max, t, n);
88 }
89 }
90
91 template <class Tree>
92 [[nodiscard]] static constexpr bool traversable(Pred const& p, Tree const& t,
93 TreeIndex const& n)
94 {
95 if constexpr (Negated) {
96 return true;
97 } else {
98 return innerCheck(p.min, t, n) && innerCheck(p.max, t, n);
99 }
100 }
101};
102} // namespace ufo::pred
103
104#endif // UFO_MAP_OCCUPANCY_PREDICATE_OCCUPANCY_INTERVAL_HPP
Utilizing curiously recurring template pattern (CRTP)
Definition tree.hpp:104
constexpr Vec< Geometry::dimension(), typename Geometry::value_type > max(Geometry const &g)
Returns the maximum coordinate of the minimum spanning axis-aligned bounding box of a geometry.
Definition fun.hpp:72
constexpr Vec< Geometry::dimension(), typename Geometry::value_type > min(Geometry const &g)
Returns the minimum coordinate of the minimum spanning axis-aligned bounding box of a geometry.
Definition fun.hpp:58