Skip to content

Instantly share code, notes, and snippets.

@thomasweng15
Created August 1, 2017 19:15
Show Gist options
  • Save thomasweng15/d7fa910cfa08f12076fbc29cc8488a7f to your computer and use it in GitHub Desktop.
Save thomasweng15/d7fa910cfa08f12076fbc29cc8488a7f to your computer and use it in GitHub Desktop.
bound box stub for octomap
// get object marker then raycast box edges
// then expand to multiple objects
octomap::OcTreeKey bbxMinKey, bbxMaxKey;
double min_x, min_y, min_z;
octree->getMetricMin(min_x, min_y, min_z);
octomap::point3d min = octomap::point3d(float(min_x), float(min_y), float(min_z));
double max_x, max_y, max_z;
octree->getMetricMax(max_x, max_y, max_z);
octomap::point3d max = octomap::point3d(float(max_x), float(max_y), float(max_z));
octree->coordToKeyChecked(min, bbxMinKey);
octree->coordToKeyChecked(max, bbxMaxKey);
octomap::OcTree::leaf_bbx_iterator end = octree->end_leafs_bbx();
for (octomap::OcTree::leaf_bbx_iterator it = octree->begin_leafs_bbx(bbxMinKey, bbxMaxKey); it != end; it++) {
hit++;
octree->deleteNode(it.getKey());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment