48#include <pcl/pcl_exports.h>
64 template<
class UserData>
148 children_[0] = children_[1] =
nullptr;
161 return static_cast<bool>(children_[0]);
185 return !
static_cast<bool>(children_[0]);
192 return !(
box[1] < bounds_[0] ||
box[3] < bounds_[2] ||
box[5] < bounds_[4] ||
193 box[0] > bounds_[1] ||
box[2] > bounds_[3] ||
box[4] > bounds_[5]);
200 return (bounds_[1] - bounds_[0]) * (bounds_[3] - bounds_[2]) * (bounds_[5] - bounds_[4]);
240 std::sort (
objects.begin (),
objects.end (), BoundedObject::compareCentroidsXCoordinates);
254 inline const std::vector<BoundedObject*>*
257 return (sorted_objects_);
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
static bool compareCentroidsXCoordinates(const BoundedObject *a, const BoundedObject *b)
This method is for std::sort.
UserData data_
This is the user-defined data object.
BoundedObject(const UserData &data)
const float * getCentroid() const
BoundedObject * getObject()
Node(std::vector< BoundedObject * > &sorted_objects, int first_id, int last_id)
'sorted_objects' is a sorted vector of bounded objects.
bool intersect(const float box[6]) const
Returns true if 'box' intersects or touches (with a side or a vertex) this node.
double computeBoundingBoxVolume() const
Computes and returns the volume of the bounding box of this node.
This class is an implementation of bounding volume hierarchies.
std::vector< BoundedObject * > * sorted_objects_
void clear()
Frees the memory allocated by this object.
bool intersect(const float box[6], std::list< BoundedObject * > &intersected_objects) const
Pushes back in 'intersected_objects' the bounded objects intersected by the input 'box' and returns t...
const std::vector< BoundedObject * > * getInputObjects() const
void build(std::vector< BoundedObject * > &objects)
Creates the tree.