205 NodeDataCreator* node_data_creator)
207 if ( voxel_size <= 0 )
215 Scalar extent = std::max (std::max (bounds[1]-bounds[0], bounds[3]-bounds[2]), bounds[5]-bounds[4]);
216 Scalar center[3] = {
static_cast<Scalar
> (0.5)*(bounds[0]+bounds[1]),
217 static_cast<Scalar
> (0.5)*(bounds[2]+bounds[3]),
218 static_cast<Scalar
> (0.5)*(bounds[4]+bounds[5])};
220 Scalar arg = extent/voxel_size;
224 tree_levels_ =
static_cast<int> (std::ceil (std::log (arg)/std::log (2.0)) + 0.5);
229 Scalar half_root_side =
static_cast<Scalar
> (0.5f*pow (2.0,
tree_levels_)*voxel_size);
232 bounds_[0] = center[0] - half_root_side;
233 bounds_[1] = center[0] + half_root_side;
234 bounds_[2] = center[1] - half_root_side;
235 bounds_[3] = center[1] + half_root_side;
236 bounds_[4] = center[2] - half_root_side;
237 bounds_[5] = center[2] + half_root_side;
241 root_->setCenter (center);
243 root_->setParent (
nullptr);
244 root_->computeRadius ();