diff --git a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index 426fc269f..8a1d588c2 100644 --- a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -76,7 +76,6 @@ inline typename geometry::point_type::type get_from_index( >::apply(segment, point); return point; } -#endif // this will go too template @@ -90,6 +89,7 @@ static inline void point_arrange(Point const& p1, Point const& p2, T& s_1, T& s_ swapped = true; } } +#endif } #endif // DOXYGEN_NO_DETAIL @@ -764,24 +764,6 @@ all this stuff can be removed completely RobustPoint const& robust_a1, RobustPoint const& robust_a2, RobustPoint const& robust_b1, RobustPoint const& robust_b2) { - typedef typename geometry::coordinate_type - < - RobustPoint - >::type robust_coordinate_type; - - // TEMP this will be removed, we will use only originals - robust_coordinate_type a_1, a_2, b_1, b_2; - bool a_swapped = false, b_swapped = false; - detail::point_arrange(robust_a1, robust_a2, a_1, a_2, a_swapped); - detail::point_arrange(robust_b1, robust_b2, b_1, b_2, b_swapped); - if (a_2 < b_1 || a_1 > b_2) - { - // This will then be done below in relate_collinear - // As soon as we refactor rational to segment_ratio - return Policy::disjoint(); - } - // END TEMP - return relate_collinear(a, b, get(robust_a1), get(robust_a2), @@ -836,6 +818,16 @@ all this stuff can be removed completely ratio_type const rb_from(ob_1 - oa_1, length_a); ratio_type const rb_to(ob_2 - oa_1, length_a); + static ratio_type const zero(0, 1); + static ratio_type const one(1, 1); + bool const sanity_check_b_disjoint = ((rb_from < zero && rb_to < zero) || (rb_from > one && rb_to > one)); + if ((ra_from < zero && ra_to < zero) || (ra_from > one && ra_to > one)) + { + assert(sanity_check_b_disjoint); // this will go + return Policy::disjoint(); + } + assert(! sanity_check_b_disjoint); + return Policy::segments_collinear(a, b, ra_from, ra_to, rb_from, rb_to); } }; diff --git a/test/strategies/segment_intersection_collinear.cpp b/test/strategies/segment_intersection_collinear.cpp index 79cadc9c8..4394bb86a 100644 --- a/test/strategies/segment_intersection_collinear.cpp +++ b/test/strategies/segment_intersection_collinear.cpp @@ -290,8 +290,9 @@ void test_all() 'e', true, 0, 0, 2, 0, 6, 0); - // a1---------->a2 - // b2<----------b1 + // Disjoint (in vertical direction, picture still horizontal) + // a2<---a1 + // b2<---b1 test_segment_intersection

("case_recursive_boxes_1", 10, 7, 10, 6, 10, 10, 10, 9,