15 #include <mrpt/containers/yaml.h>
16 #include <mrpt/math/ops_containers.h>
32 "At least one 'inside_pointcloud_layer' or "
33 "'outside_pointcloud_layer' must be provided.");
36 c.has(
"bounding_box_min") && c[
"bounding_box_min"].isSequence() &&
37 c[
"bounding_box_min"].asSequence().size() == 3);
39 c.has(
"bounding_box_max") && c[
"bounding_box_max"].isSequence() &&
40 c[
"bounding_box_max"].asSequence().size() == 3);
42 const auto bboxMin = c[
"bounding_box_min"].asSequence();
43 const auto bboxMax = c[
"bounding_box_max"].asSequence();
45 for (
int i = 0; i < 3; i++)
56 mrpt::system::COutputLogger::setLoggerName(
"FilterBoundingBox");
63 MRPT_LOG_DEBUG_STREAM(
"Loading these params:\n" << c);
77 "Input point cloud layer '%s' was not found.",
80 const auto& pc = *pcPtr;
87 pcPtr->GetRuntimeClass()->className);
89 if (insidePc) insidePc->reserve(insidePc->size() + pc.size() / 10);
95 pcPtr->GetRuntimeClass()->className);
97 if (outsidePc) outsidePc->reserve(outsidePc->size() + pc.size() / 10);
99 const auto& xs = pc.getPointsBufferRef_x();
100 const auto& ys = pc.getPointsBufferRef_y();
101 const auto& zs = pc.getPointsBufferRef_z();
103 for (
size_t i = 0; i < xs.size(); i++)
105 const bool isInside =
108 auto* targetPc = isInside ? insidePc.get() : outsidePc.get();
110 if (targetPc) targetPc->insertPointFrom(pc, i);