From dbeb823fcbd8ef5c30f8c2a7f25f3ac2300a0f27 Mon Sep 17 00:00:00 2001 From: Adam Wulkiewicz Date: Sat, 14 Mar 2015 03:55:44 +0100 Subject: [PATCH] [strategies][cart_intersect] Use equals() with policy. Compare the floating-point results of cramer's rule (denominators) using the epsilon scaled by the greatest of the differences of coordinates of the segments' endpoints (the input of the determinant formula). --- .../boost/geometry/strategies/cartesian/cart_intersect.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index e90af64f1..6e5976c05 100644 --- a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -200,8 +200,11 @@ struct relate_cartesian_segments get<1>(robust_b1) - get<1>(robust_a1), robust_db0, robust_db); + math::detail::equals_factor_policy + policy(robust_dx_a, robust_dy_a, robust_dx_b, robust_dy_b); robust_coordinate_type const zero = 0; - if (math::equals(robust_da0, zero) || math::equals(robust_db0, zero)) + if (math::detail::equals_by_policy(robust_da0, zero, policy) + || math::detail::equals_by_policy(robust_db0, zero, policy)) { // If this is the case, no rescaling is done for FP precision. // We set it to collinear, but it indicates a robustness issue.