209 NodeDataCreator* node_data_creator)
211 if ( voxel_size <= 0 )
219 Scalar extent = std::max (std::max (bounds[1]-bounds[0], bounds[3]-bounds[2]), bounds[5]-bounds[4]);
220 Scalar center[3] = {
static_cast<Scalar
> (0.5)*(bounds[0]+bounds[1]),
221 static_cast<Scalar
> (0.5)*(bounds[2]+bounds[3]),
222 static_cast<Scalar
> (0.5)*(bounds[4]+bounds[5])};
224 Scalar arg = extent/voxel_size;
228 tree_levels_ =
static_cast<int> (std::ceil (std::log (arg)/std::log (2.0)) + 0.5);
233 Scalar half_root_side =
static_cast<Scalar
> (0.5f*pow (2.0,
tree_levels_)*voxel_size);
236 bounds_[0] = center[0] - half_root_side;
237 bounds_[1] = center[0] + half_root_side;
238 bounds_[2] = center[1] - half_root_side;
239 bounds_[3] = center[1] + half_root_side;
240 bounds_[4] = center[2] - half_root_side;
241 bounds_[5] = center[2] + half_root_side;
245 root_->setCenter (center);
247 root_->setParent (
nullptr);
248 root_->computeRadius ();