Navigation Menu

Skip to content

Commit

Permalink
add containsPoint() method
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Sep 21, 2021
1 parent 78ea3a0 commit d7d180e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/source/doxygen-docs/changelog.md
Expand Up @@ -23,6 +23,7 @@
- \ref mrpt_math_grp
- New function mrpt::math::xcorr()
- New header `<mrpt/math/gtsam_wrappers.h>`, see \ref mrpt_gtsam_wrappers
- New method mrpt::math::TBoundingBox::containsPoint()
- \ref mrpt_maps_grp
- Optimization: mrpt::maps::CPointsMap::insertAnotherMap() avoids matrix multiplication if SE(3) identity is passed as insertion pose.
- \ref mrpt_nav_grp
Expand Down
10 changes: 10 additions & 0 deletions libs/math/include/mrpt/math/TBoundingBox.h
Expand Up @@ -107,6 +107,16 @@ struct TBoundingBox_
mrpt::keep_max(max.z, p.z);
}

/** Returns true if the point lies within the bounding box (including the
* exact border)
* \note (New in MRPT 2.3.3)
*/
bool containsPoint(const mrpt::math::TPoint3D_<T>& p) const
{
return p.x >= min.x && p.y >= min.y && p.z >= min.z && p.x <= max.x &&
p.y <= max.y && p.z <= max.z;
}

/** Returns a new bounding box, transforming `this` from local coordinates
* to global coordinates, as if `this` was given with respect to `pose`, ie:
*
Expand Down

0 comments on commit d7d180e

Please sign in to comment.