Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OCTREE] Add bounding box checks in isVoxelOccupiedAtPoint() and deleteVoxelAtPoint() #1976

Merged
merged 1 commit into from
Aug 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions octree/include/pcl/octree/impl/octree_pointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>
template<typename PointT, typename LeafContainerT, typename BranchContainerT, typename OctreeT> bool
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::isVoxelOccupiedAtPoint (const PointT& point_arg) const
{
if (!isPointWithinBoundingBox (point_arg))
{
return false;
}

OctreeKey key;

// generate key for point
this->genOctreeKeyforPoint (point_arg, key);

// search for key in octree
return (isPointWithinBoundingBox (point_arg) && this->existLeaf (key));
return (this->existLeaf (key));
}

//////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -154,18 +159,25 @@ template<typename PointT, typename LeafContainerT, typename BranchContainerT, ty
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::isVoxelOccupiedAtPoint (
const double point_x_arg, const double point_y_arg, const double point_z_arg) const
{
OctreeKey key;

// generate key for point
this->genOctreeKeyforPoint (point_x_arg, point_y_arg, point_z_arg, key);
// create a new point with the argument coordinates
PointT point;
point.x = point_x_arg;
point.y = point_y_arg;
point.z = point_z_arg;

return (this->existLeaf (key));
// search for voxel at point in octree
return (this->isVoxelOccupiedAtPoint (point));
}

//////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT, typename LeafContainerT, typename BranchContainerT, typename OctreeT> void
pcl::octree::OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>::deleteVoxelAtPoint (const PointT& point_arg)
{
if (!isPointWithinBoundingBox (point_arg))
{
return;
}

OctreeKey key;

// generate key for point
Expand Down