Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ppf: remove redundant codes #6230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forget a minus sign here?

And I am still not sure about +pi becoming -pi. Even if they represent the same angle, couldn't this cause a problem in the discretization in PPFRegistration?

}
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
Loading