48 #include "simple_octree.h"
49 #include "model_library.h"
50 #include <pcl/pcl_exports.h>
108 if ( rigid_transform )
147 inline std::map<const ModelLibrary::Model*,Entry>&
156 std::map<const ModelLibrary::Model*, Entry>::const_iterator res =
model_to_entry_.find (model);
159 return (&res->second);
167 return model_to_entry_[model].addRigidTransform (axis_angle, translation);
201 float min = -(AUX_PI_FLOAT + 0.000000001f), max = AUX_PI_FLOAT + 0.000000001f;
202 float bounds[6] = {min, max, min, max, min, max};
205 octree_.build (bounds, discretization, &cell_creator_);
228 const std::vector<CellOctree::Node*>& full_leaves = octree_.getFullLeaves ();
229 int max_num_transforms = 0;
232 for (
const auto &full_leaf : full_leaves)
240 const std::set<CellOctree::Node*>& neighs = full_leaf->getNeighbors ();
243 for (
const auto &neigh : neighs)
252 if ( num_transforms > max_num_transforms )
254 with_most_votes = *entry;
255 max_num_transforms = num_transforms;
259 if ( !max_num_transforms )
270 CellOctree::Node* cell = octree_.createLeaf (axis_angle[0], axis_angle[1], axis_angle[2]);
274 const float *b = octree_.getBounds ();
275 printf (
"WARNING in 'RotationSpace::%s()': the provided axis-angle input (%f, %f, %f) is "
276 "out of the rotation space bounds ([%f, %f], [%f, %f], [%f, %f]).\n",
277 __func__, axis_angle[0], axis_angle[1], axis_angle[2], b[0], b[1], b[2], b[3], b[4], b[5]);
282 cell->getData ().addRigidTransform (model, axis_angle, translation);
305 rot_space->
setCenter (leaf->getCenter ());
319 const std::list<RotationSpace*>&
322 std::list<RotationSpace*>&
347 build (
const float* pos_bounds,
float translation_cell_size,
float rotation_cell_size)
351 rotation_space_creator_.setDiscretization (rotation_cell_size);
353 pos_octree_.build (pos_bounds, translation_cell_size, &rotation_space_creator_);
359 pos_octree_.clear ();
360 rotation_space_creator_.reset ();
363 inline std::list<RotationSpace*>&
366 return (rotation_space_creator_.getRotationSpaces ());
369 inline const std::list<RotationSpace*>&
372 return (rotation_space_creator_.getRotationSpaces ());
378 return (rotation_space_creator_.getNumberOfRotationSpaces ());
385 RotationSpaceOctree::Node* leaf = pos_octree_.createLeaf (position[0], position[1], position[2]);
389 printf (
"WARNING in 'RigidTransformSpace::%s()': the input position (%f, %f, %f) is out of bounds.\n",
390 __func__, position[0], position[1], position[2]);
394 float rot_angle, axis_angle[3];
401 leaf->getData ().addRigidTransform (model, axis_angle, rigid_transform + 9);