Skip to content

Commit

Permalink
ppf: remove redundant codes
Browse files Browse the repository at this point in the history
  • Loading branch information
YeHuanjie committed Feb 4, 2025
1 parent 460d9fc commit e716872
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 2 additions & 4 deletions features/include/pcl/features/impl/ppf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ pcl::PPFEstimation<PointInT, PointNT, PointOutT>::computeFeature (PointCloudOut
Eigen::Affine3f transform_mg (Eigen::Translation3f ( rotation_mg * ((-1) * model_reference_point)) * rotation_mg);

Eigen::Vector3f model_point_transformed = transform_mg * model_point;
float angle = std::atan2 ( -model_point_transformed(2), model_point_transformed(1));
if (std::sin (angle) * model_point_transformed(2) < 0.0f)
angle *= (-1);
p.alpha_m = -angle;
float angle = std::atan2 (model_point_transformed(2), model_point_transformed(1));
p.alpha_m = angle;
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,16 @@ pcl::PPFRegistration<PointSource, PointTarget>::computeTransformation(

const Eigen::Vector3f scene_point_transformed = transform_sg * scene_point;
float alpha_s =
std::atan2(-scene_point_transformed(2), scene_point_transformed(1));
if (std::sin(alpha_s) * scene_point_transformed(2) < 0.0f)
alpha_s *= (-1);
alpha_s *= (-1);
std::atan2(scene_point_transformed(2), scene_point_transformed(1));

// Go through point pairs in the model with the same discretized feature
for (const auto& nearest_index : nearest_indices) {
std::size_t model_reference_index = nearest_index.first;
std::size_t model_point_index = nearest_index.second;
// Calculate angle alpha = alpha_m - alpha_s
float alpha =
search_method_->alpha_m_[model_reference_index][model_point_index] -
alpha_s;
alpha_s -
search_method_->alpha_m_[model_reference_index][model_point_index];
if (alpha < -M_PI) {
alpha += (2 * M_PI);
}
Expand Down

0 comments on commit e716872

Please sign in to comment.