Skip to content

Commit 90d7cc3

Browse files
committed
Fixed cropBoxImpl() asserting when voxel filtering large 2D clouds (where min z == max z)
1 parent 3268707 commit 90d7cc3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

corelib/src/util3d_filtering.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,8 @@ pcl::IndicesPtr cropBoxImpl(
954954
const Transform & transform,
955955
bool negative)
956956
{
957-
UASSERT(min[0] < max[0] && min[1] < max[1] && min[2] < max[2]);
957+
UASSERT_MSG(min[0] < max[0] && min[1] < max[1] && min[2] <= max[2], // z can be equal in 2D case
958+
uFormat("x=%f->%f y=%f->%f z=%f->%f", min[0], max[0], min[1], max[1], min[2], max[2]).c_str());
958959

959960
pcl::IndicesPtr output(new std::vector<int>);
960961
pcl::CropBox<PointT> filter;
@@ -973,7 +974,8 @@ pcl::IndicesPtr cropBoxImpl(
973974

974975
pcl::IndicesPtr cropBox(const pcl::PCLPointCloud2::Ptr & cloud, const pcl::IndicesPtr & indices, const Eigen::Vector4f & min, const Eigen::Vector4f & max, const Transform & transform, bool negative)
975976
{
976-
UASSERT(min[0] < max[0] && min[1] < max[1] && min[2] < max[2]);
977+
UASSERT_MSG(min[0] < max[0] && min[1] < max[1] && min[2] <= max[2], // z can be equal in 2D case
978+
uFormat("x=%f->%f y=%f->%f z=%f->%f", min[0], max[0], min[1], max[1], min[2], max[2]).c_str());
977979

978980
pcl::IndicesPtr output(new std::vector<int>);
979981
pcl::CropBox<pcl::PCLPointCloud2> filter;

0 commit comments

Comments
 (0)