From 83a1e075065e294c19015a6cd5bcbc3d06a27ae2 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Tue, 4 Dec 2018 22:31:59 +0100 Subject: [PATCH] [buffer] do not calculate robust points in assign, but before. This is slightly less performant (because it is now also calculated for non-intersecting segments) but probably not significant, and, more importantly, rescaling will be gone later --- .../detail/buffer/get_piece_turns.hpp | 42 ++++--------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp index 88caf81a2..1cad9b8cd 100644 --- a/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/get_piece_turns.hpp @@ -34,35 +34,6 @@ namespace boost { namespace geometry namespace detail { namespace buffer { - -#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION) -struct buffer_assign_turn -{ - static bool const include_no_turn = false; - static bool const include_degenerate = false; - static bool const include_opposite = false; - - template - < - typename Info, - typename Point1, - typename Point2, - typename IntersectionInfo - > - static inline void apply(Info& info, - Point1 const& /*p1*/, - Point2 const& /*p2*/, - IntersectionInfo const& iinfo) - { - info.rob_pi = iinfo.rpi(); - info.rob_pj = iinfo.rpj(); - info.rob_qi = iinfo.rqi(); - info.rob_qj = iinfo.rqj(); - } - -}; -#endif - template struct unique_sub_range_from_piece { @@ -281,6 +252,10 @@ class piece_turn_visitor the_model.operations[1].piece_index = piece2.index; the_model.operations[1].seg_id = piece2.first_seg_id; the_model.operations[1].seg_id.segment_index = index2; // override +#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION) + geometry::recalculate(the_model.rob_pi, *prev1, m_robust_policy); + geometry::recalculate(the_model.rob_pj, *it1, m_robust_policy); +#endif unique_sub_range_from_piece unique_sub_range1(ring1, prev1, it1); @@ -290,6 +265,10 @@ class piece_turn_visitor prev2 = it2++, the_model.operations[1].seg_id.segment_index++) { unique_sub_range_from_piece unique_sub_range2(ring2, prev2, it2); +#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION) + geometry::recalculate(the_model.rob_qi, *prev2, m_robust_policy); + geometry::recalculate(the_model.rob_qj, *it2, m_robust_policy); +#endif // TODO: internally get_turn_info calculates robust points. // But they are already calculated. @@ -298,14 +277,9 @@ class piece_turn_visitor // and iterating in sync with them... typedef detail::overlay::get_turn_info < -#if defined(BOOST_GEOMETRY_BUFFER_USE_SIDE_OF_INTERSECTION) - buffer_assign_turn -#else detail::overlay::assign_null_policy -#endif > turn_policy; - turn_policy::apply(the_model, m_intersection_strategy, unique_sub_range1, unique_sub_range2,