提交 f8bd7e56 编写于 作者: D Dong Li 提交者: Jiangtao Hu

localization: remove power2 function

上级 ec1eec9c
......@@ -83,8 +83,10 @@ class FeatureXYPlane {
std::clock_t plane_time;
plane_time = std::clock();
int total_plane_num = 0;
double power2 = 0.5; // 2^-1
for (int iter = 0; iter <= iter_num; ++iter) {
double grid_size = max_grid_size_ / Power2(iter);
power2 *= 2;
double grid_size = max_grid_size_ / power2;
VoxelGridCovariance<PointT> vgc;
vgc.setInputCloud(pointcloud_ptr);
vgc.SetMinPointPerVoxel(min_planepoints_number_);
......@@ -180,31 +182,6 @@ class FeatureXYPlane {
return true;
}
double Power2(int x) {
if (power2_map_.find(x) != power2_map_.end()) {
return power2_map_[x];
}
if (x < 0) {
const double res = 1.0 / Power2(-x);
power2_map_[x] = res;
return res;
} else if (x == 0) {
return 1.0;
}
const double d = Power2(x / 2);
double res = 0.0;
if (x % 2 == 0) {
res = d * d;
} else {
res = 2 * d * d;
}
power2_map_[x] = res;
return res;
}
std::unordered_map<int, double> power2_map_;
private:
// parameters
double min_grid_size_;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册