From 8e8a778a5f88708a4a5079efb6bd18e085c98397 Mon Sep 17 00:00:00 2001 From: sand-box Date: Fri, 26 Aug 2016 08:03:15 +0100 Subject: [PATCH] Fix issue #1695. Test for parallel planes in planePlaneIntersection. --- common/include/pcl/common/impl/intersections.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/common/include/pcl/common/impl/intersections.hpp b/common/include/pcl/common/impl/intersections.hpp index 619a888e22a..1a286ed107e 100644 --- a/common/include/pcl/common/impl/intersections.hpp +++ b/common/include/pcl/common/impl/intersections.hpp @@ -89,12 +89,11 @@ pcl::planeWithPlaneIntersection (const Eigen::Matrix &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);