UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
contains_void_region.hpp
1
42#ifndef UFO_MAP_VOID_REGION_PREDICATE_CONTAINS_VOID_REGION_HPP
43#define UFO_MAP_VOID_REGION_PREDICATE_CONTAINS_VOID_REGION_HPP
44
45// UFO
46#include <ufo/container/tree/predicate/filter.hpp>
47#include <ufo/utility/type_traits.hpp>
48
49namespace ufo::pred
50{
51template <bool Negated = false>
53};
54
55static constexpr ContainsVoidRegion const contains_void_region;
56
57template <bool Negated>
59{
61}
62
63template <bool Negated>
64struct Filter<ContainsVoidRegion<Negated>>
65 : FilterBase<ContainsVoidRegion<Negated>, FilterType::INIT, FilterType::VALUE,
66 FilterType::RAY> {
68
69 template <class Tree>
70 [[nodiscard]] static constexpr bool returnable(Pred const&, Tree const& t,
71 typename Tree::Node const& n)
72 {
73 if constexpr (Negated) {
74 return !t.voidRegionContains(n.index);
75 } else {
76 return t.voidRegionContains(n.index);
77 }
78 }
79
80 template <class Tree>
81 [[nodiscard]] static constexpr bool traversable(Pred const&, Tree const& t,
82 typename Tree::Node const& n)
83 {
84 if constexpr (Negated) {
85 return true;
86 } else {
87 return t.voidRegionContains(n.index);
88 }
89 }
90};
91} // namespace ufo::pred
92
93#endif // UFO_MAP_VOID_REGION_PREDICATE_CONTAINS_VOID_REGION_HPP
Utilizing curiously recurring template pattern (CRTP)
Definition tree.hpp:104