-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Fixed rounding error angle calculation of parallel and anti-parallel vec... #1035
Conversation
There actually exists a function in common doing something similar: |
What about adding a new overload in common? getAngle3D (const Eigen::Vector3f &v1, const Eigen::Vector3f &v2) As for the radians to degree conversion, there is float intersection_angle = rad2deg (getAngle3D (ncross, vec_t_to_s)); (Does not look too ugly to me, what do you think? :)) |
I thought about the the same. I guess if it is ok to add a new overloaded function to common, I would just change it to that. |
what about a boolean flag in the function |
Just make sure the last coordinates are zero. |
dot product yes, but not cross product? At least I don't know a definition ouside of three dimensions. |
Oh sorry I misread; you should be able to do these computations without a cross product though. |
0777347
to
d06aaeb
Compare
Implementing cross functions was actually what I had in the code in the first place, but it was confusing and redundent. In my oppinion an overloaded function in common makes most sense. |
i also made the code for |
oh, forgot to change the if to else if. |
@@ -428,11 +429,11 @@ pcl::LCCPSegmentation<PointT>::connIsConvex (uint32_t source_label_arg, | |||
typename pcl::Supervoxel<PointT>::Ptr& sv_source = sv_label_to_supervoxel_map_[source_label_arg]; | |||
typename pcl::Supervoxel<PointT>::Ptr& sv_target = sv_label_to_supervoxel_map_[target_label_arg]; | |||
|
|||
const pcl::PointXYZRGBA& source_centroid = sv_source->centroid_; | |||
const pcl::PointXYZRGBA& target_centroid = sv_target->centroid_; | |||
const Eigen::Vector3f source_centroid = sv_source->centroid_.getVector3fMap (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this a reference to avoid copying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
d06aaeb
to
6db2d26
Compare
6db2d26
to
40f4d78
Compare
Fixed rounding error angle calculation of parallel and anti-parallel vec...
This fixes angle convexity calculation for parallel and anti-parallel normals, where a rounding error occasionally caused NaN angles.
This solves issue #1033.