From ec6f9148cd86580fce96d2af0d6feada01946027 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Thu, 12 Mar 2015 23:03:27 +0100 Subject: [PATCH] [strategies][cart_intersect] Compare ratios denominators consistently. Compare both ratios' potential denominators, corresponding to both segments. Furthermore, take into account the machine epsilon. --- include/boost/geometry/strategies/cartesian/cart_intersect.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index bb0749d61b..e90af64f15 100644 --- a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -200,7 +200,8 @@ struct relate_cartesian_segments get<1>(robust_b1) - get<1>(robust_a1), robust_db0, robust_db); - if (robust_da0 == 0) + robust_coordinate_type const zero = 0; + if (math::equals(robust_da0, zero) || math::equals(robust_db0, zero)) { // If this is the case, no rescaling is done for FP precision. // We set it to collinear, but it indicates a robustness issue.