diff --git a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp index e0d75108b..fdae07842 100644 --- a/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/get_turn_info_helpers.hpp @@ -217,7 +217,9 @@ public: : base_t(pi, pj, pk, qi, qj, qk, robust_policy) , m_result(strategy::apply(segment_type1(pi, pj), segment_type2(qi, qj), - robust_policy)) + robust_policy, + base_t::rpi(), base_t::rpj(), + base_t::rqi(), base_t::rqj())) , m_robust_policy(robust_policy) {} diff --git a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index 4b3010a40..8a9857376 100644 --- a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -119,15 +119,10 @@ struct relate_cartesian_segments boost::ignore_unused_variable_warning(robust_policy); - typedef typename select_calculation_type - ::type coordinate_type; - using geometry::detail::equals::equals_point_point; bool const a_is_point = equals_point_point(robust_a1, robust_a2); bool const b_is_point = equals_point_point(robust_b1, robust_b2); - typedef side::side_by_triangle side; - if(a_is_point && b_is_point) { return equals_point_point(robust_a1, robust_b2) @@ -136,20 +131,32 @@ struct relate_cartesian_segments ; } + typedef typename select_calculation_type + ::type coordinate_type; + + typedef side::side_by_triangle side; + side_info sides; sides.set<0>(side::apply(robust_b1, robust_b2, robust_a1), side::apply(robust_b1, robust_b2, robust_a2)); - sides.set<1>(side::apply(robust_a1, robust_a2, robust_b1), - side::apply(robust_a1, robust_a2, robust_b2)); - bool collinear = sides.collinear(); - - if (sides.same<0>() || sides.same<1>()) + if (sides.same<0>()) { // Both points are at same side of other segment, we can leave return Policy::disjoint(); } + sides.set<1>(side::apply(robust_a1, robust_a2, robust_b1), + side::apply(robust_a1, robust_a2, robust_b2)); + + if (sides.same<1>()) + { + // Both points are at same side of other segment, we can leave + return Policy::disjoint(); + } + + bool collinear = sides.collinear(); + typedef typename select_most_precise < coordinate_type, double