Skip to content

Commit

Permalink
Fix CropHull::applyFilter3D()
Browse files Browse the repository at this point in the history
Fix CropHull::applyFilter3D() when crop_outside_ is false and add back
test_crop_inside for 3D
  • Loading branch information
yasamoka committed May 12, 2022
1 parent 86ee13a commit c3a5f34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
5 changes: 2 additions & 3 deletions filters/include/pcl/filters/impl/crop_hull.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,8 @@ pcl::CropHull<PointT>::applyFilter3D (Indices &indices)
crossings[ray] += rayTriangleIntersect
((*input_)[(*indices_)[index]], rays[ray], hull_polygons_[poly], *hull_cloud_);

if (crop_outside_ && (crossings[0]&1) + (crossings[1]&1) + (crossings[2]&1) > 1)
indices.push_back ((*indices_)[index]);
else if (!crop_outside_)
bool crosses = (crossings[0]&1) + (crossings[1]&1) + (crossings[2]&1) > 1;
if ((crop_outside_ && crosses) || (!crop_outside_ && !crosses))
indices.push_back ((*indices_)[index]);
else
removed_indices_->push_back ((*indices_)[index]);
Expand Down
13 changes: 1 addition & 12 deletions test/filters/test_crop_hull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,18 +383,7 @@ TYPED_TEST (PCLCropHullTestFixture, test_keep_organized)


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// this test will pass only for 2d case //
template <class T>
struct PCLCropHullTestFixture2dCrutch : PCLCropHullTestFixture<T>
{};
using CropHullTestTraits2dTypes = ::testing::Types<
std::tuple_element<0, CropHullTestTraits2dList>::type,
std::tuple_element<1, CropHullTestTraits2dList>::type,
std::tuple_element<2, CropHullTestTraits2dList>::type
>;
TYPED_TEST_SUITE(PCLCropHullTestFixture2dCrutch, CropHullTestTraits2dTypes);

TYPED_TEST (PCLCropHullTestFixture2dCrutch, test_crop_inside)
TYPED_TEST (PCLCropHullTestFixture, test_crop_inside)
{
for (auto & entry : this->data_)
{
Expand Down

0 comments on commit c3a5f34

Please sign in to comment.