diff --git a/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp b/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp index 4154d9c45..99a70baf7 100644 --- a/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/handle_tangencies.hpp @@ -128,7 +128,10 @@ private : typedef segment_intersection_points < point_type, - segment_ratio // TODO finetune this + typename segment_ratio_type + < + point_type, RescalePolicy + >::type > intersection_return_type; typedef strategy::intersection::relate_cartesian_segments diff --git a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp index c49c0e35d..b0e8c8a9b 100644 --- a/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp +++ b/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp @@ -85,7 +85,10 @@ struct intersection_segment_segment_point typedef segment_intersection_points < point_type, - segment_ratio // TODO finetune this + typename segment_ratio_type + < + point_type, RescalePolicy + >::type > intersection_return_type; typedef strategy::intersection::relate_cartesian_segments diff --git a/include/boost/geometry/algorithms/disjoint.hpp b/include/boost/geometry/algorithms/disjoint.hpp index 1ef9f1d4d..678b0e96d 100644 --- a/include/boost/geometry/algorithms/disjoint.hpp +++ b/include/boost/geometry/algorithms/disjoint.hpp @@ -146,10 +146,18 @@ struct disjoint_segment { typedef typename point_type::type point_type; + // We don't need to rescale to detect disjointness + typedef no_rescale_policy rescale_policy_type; + rescale_policy_type rescale_policy; + typedef segment_intersection_points < point_type, - segment_ratio // TODO finetune this + typename segment_ratio_type + < + point_type, + rescale_policy_type + >::type > intersection_return_type; intersection_return_type is @@ -159,7 +167,7 @@ struct disjoint_segment < intersection_return_type > - >::apply(segment1, segment2); + >::apply(segment1, segment2, rescale_policy); return is.count == 0; } diff --git a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp index 38cd2bab9..b4a3dbfd1 100644 --- a/include/boost/geometry/strategies/cartesian/cart_intersect.hpp +++ b/include/boost/geometry/strategies/cartesian/cart_intersect.hpp @@ -34,6 +34,7 @@ // TODO move to policies folder #include +#include #if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS) @@ -83,19 +84,32 @@ struct relate_cartesian_segments // Relate segments a and b - template - static inline return_type apply(Segment1 const& a, Segment2 const& b) + template + static inline return_type apply(Segment1 const& a, Segment2 const& b, + RobustPolicy const& robust_policy) { - // TODO: revise this or remove this overload - // This considers two segments without robustness checks - typename geometry::point_type::type a0, a1, b0, b1; // type them all as in first + // type them all as in Segment1 - TODO reconsider this, most precise? + typedef typename geometry::point_type::type point_type; + + typedef typename geometry::robust_point_type + < + point_type, RobustPolicy + >::type robust_point_type; + + point_type a0, a1, b0, b1; + robust_point_type a0_rob, a1_rob, b0_rob, b1_rob; + detail::assign_point_from_index<0>(a, a0); detail::assign_point_from_index<1>(a, a1); detail::assign_point_from_index<0>(b, b0); detail::assign_point_from_index<1>(b, b1); - geometry::detail::no_rescale_policy robust_policy; - return apply(a, b, robust_policy, a0, a1, b0, b1); + geometry::recalculate(a0_rob, a0, robust_policy); + geometry::recalculate(a1_rob, a1, robust_policy); + geometry::recalculate(b0_rob, b0, robust_policy); + geometry::recalculate(b1_rob, b1, robust_policy); + + return apply(a, b, robust_policy, a0_rob, a1_rob, b0_rob, b1_rob); } // The main entry-routine, calculating intersections of segments a / b diff --git a/include/boost/geometry/strategies/intersection_result.hpp b/include/boost/geometry/strategies/intersection_result.hpp index 210fb6695..656466d4d 100644 --- a/include/boost/geometry/strategies/intersection_result.hpp +++ b/include/boost/geometry/strategies/intersection_result.hpp @@ -15,8 +15,6 @@ #include -#include - namespace boost { namespace geometry {