6#include <unordered_set>
28 using MaskSet = std::unordered_set<Voxel, Vec3iHash>;
37 using Pointer = std::shared_ptr<VolumetricMask>;
40 template <
typename... Args>
43 return std::make_shared<VolumetricMask>(std::forward<Args>(args)...);
50 template <
class Container>
53 mask_.reserve(ps.size());
54 mask_.insert(std::begin(ps), std::end(ps));
63 template <
class Container>
67 mask_.insert(std::begin(ps), std::end(ps));
71 template <
class Container>
74 for (
const auto& p : ps) {
80 [[nodiscard]]
auto isIn(
const Voxel& v)
const -> bool;
85 [[nodiscard]]
auto isIn(
const cv::Vec3d& v)
const -> bool;
87 [[nodiscard]]
auto isOut(
const cv::Vec3d& v)
const -> bool;
107 [[nodiscard]] auto
empty() const ->
bool;
Stores per-voxel mask information for a volume.
auto as_vector() const -> std::vector< Voxel >
Get the list of masked points as a vector.
void setIn(const Container &ps)
Add Voxels to mask.
void setOut(const Voxel &v)
Remove Voxel from mask.
auto isIn(const Voxel &v) const -> bool
Check whether a Voxel is in the mask.
std::shared_ptr< VolumetricMask > Pointer
auto isOut(const Voxel &v) const -> bool
Check whether a Voxel is not in the mask.
auto cend() const noexcept -> const_iterator
Get a const-iterator to one past the last element in the mask.
auto isOut(const cv::Vec3d &v) const -> bool
Check whether a sub-voxel is not in the mask.
void setOut(const Container &ps)
Remove Voxels from the mask.
void clear()
Clear the mask of all voxels.
void setIn(const Voxel &v)
Add Voxel to mask.
VolumetricMask()=default
Default constructor.
VolumetricMask(const Container &ps)
Constructor with existing Voxel container.
auto end() noexcept -> iterator
Get a const-iterator to one past the last element in the mask.
auto cbegin() const noexcept -> const_iterator
Get a const-iterator to the first element in the mask.
static auto New(Args... args) -> Pointer
auto empty() const -> bool
Check if mask is empty.
std::unordered_set< Voxel, Vec3iHash > MaskSet
auto begin() noexcept -> iterator
Get a const-iterator to the first element in the mask.
MaskSet::iterator iterator
auto isIn(const cv::Vec3d &v) const -> bool
Check whether a sub-voxel is in the mask.
MaskSet::const_iterator const_iterator
Volume Cartographer library