Skip to content

Commit

Permalink
Merge branch 'angle-limit-filter' into matej-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
boxanm committed Dec 15, 2024
2 parents 7cda3ce + c3d1683 commit e061a57
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 121 deletions.
2 changes: 1 addition & 1 deletion doc/DataFilters.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ __Impact on the number of points:__ reduces number of points
|phiMax |Maximum value on the x-axis defining one side of the box | inf | -inf to inf|
|thetaMin |Minimum value on the y-axis defining one side of the box | -inf | -inf to inf|
|thetaMax |Maximum value on the y-axis defining one side of the box | inf | -inf to inf|
|removeInside |if set to 1, points contained within the box are removed, else points outside are removed |1 | 0 or 1|
|removeInside |if set to 1, points contained within the sphere wedge are removed, else points outside are removed |1 | 0 or 1|


## Bounding Box Filter <a name="boundingboxhead"></a>
Expand Down
11 changes: 2 additions & 9 deletions pointmatcher/DataPointsFilters/AngleLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ void AngleLimitDataPointsFilter<T>::inPlaceFilter(
const int nbRows = cloud.features.rows();

int j = 0;
T angle_min = 10;
T angle_max = -10;
for(int i = 0; i < nbPoints; ++i)
{
auto point = cloud.features.col(i).head(nbRows-1);
Expand All @@ -84,22 +82,17 @@ void AngleLimitDataPointsFilter<T>::inPlaceFilter(
if (point(1) < 0)
phiPoint = -phiPoint;

if (phiPoint < angle_min)
angle_min = phiPoint;
if (phiPoint > angle_max)
angle_max = phiPoint;

if(removeInside)
{
if (phiMin < phiPoint && phiPoint < phiMax && thetaMin < thetaPoint && thetaPoint < thetaMax) // point is inside range
if((phiPoint < phiMin || phiMax < phiPoint) || (thetaPoint < thetaMin || thetaMax < thetaPoint)) // point is outside range, keep it
{
cloud.setColFrom(j, cloud, i);
++j;
}
}
else
{
if((phiPoint < phiMin || phiMax < phiPoint) || (thetaPoint < thetaMin || thetaMax < thetaPoint)) // point is outside range
if (phiMin < phiPoint && phiPoint < phiMax && thetaMin < thetaPoint && thetaPoint < thetaMax) // point is inside range, keep it
{
cloud.setColFrom(j, cloud, i);
++j;
Expand Down
2 changes: 1 addition & 1 deletion pointmatcher/DataPointsFilters/AngleLimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct AngleLimitDataPointsFilter: public PointMatcher<T>::DataPointsFilter
{"phiMax", "Upper bound of the azimuthal angle", "-inf", "-inf", "inf", &P::Comp<T>},
{"thetaMin", "Lower bound of the polar angle", "-inf", "-inf", "inf", &P::Comp<T>},
{"thetaMax", "Upper bound of the polar angle", "-inf", "-inf", "inf", &P::Comp<T>},
{"removeInside", "If set to true (1), remove points before the distance limit; else (0), remove points beyond the distance limit", "1", "0", "1", P::Comp<bool>}
{"removeInside", "If set to true (1), remove points inside the spherical wedge; else (0), remove points outside the wedge", "1", "0", "1", P::Comp<bool>}
};
}

Expand Down
Loading

0 comments on commit e061a57

Please sign in to comment.