Skip to content

Commit

Permalink
Fix issue #1695. Test for parallel planes in planePlaneIntersection.
Browse files Browse the repository at this point in the history
  • Loading branch information
sand-box committed Aug 26, 2016
1 parent 85ddd2e commit 8e8a778
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions common/include/pcl/common/impl/intersections.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,11 @@ pcl::planeWithPlaneIntersection (const Eigen::Matrix<Scalar, 4, 1> &plane_a,
plane_a_norm.normalize ();
plane_b_norm.normalize ();

// Test if planes are parallel (test_cos == 1)
// Test if planes are parallel
double test_cos = plane_a_norm.dot (plane_b_norm);
double upper_limit = 1 + angular_tolerance;
double lower_limit = 1 - angular_tolerance;
double tolerance_cos = 1 - sin (fabs (angular_tolerance));

if ((test_cos > lower_limit) && (test_cos < upper_limit))
if (fabs (test_cos) > tolerance_cos)
{
PCL_DEBUG ("Plane A and Plane B are parallel.\n");
return (false);
Expand Down

0 comments on commit 8e8a778

Please sign in to comment.