From 432d62809df113cad11397caa724b0a23bee34c3 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Mon, 9 Jun 2014 11:15:13 +0200 Subject: [PATCH] [buffer] remove old left-turn approach --- .../buffer/multi_polygon_buffer.cpp | 2 - .../algorithms/detail/get_left_turns.hpp | 342 +----------------- .../algorithms/detail/occupation_info.hpp | 100 ++--- .../algorithms/buffer/buffer_policies.hpp | 2 +- .../buffer/buffered_piece_collection.hpp | 230 ++++-------- 5 files changed, 102 insertions(+), 574 deletions(-) diff --git a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp index d290151dd..554dfdc7e 100644 --- a/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp +++ b/extensions/test/algorithms/buffer/multi_polygon_buffer.cpp @@ -321,9 +321,7 @@ void test_all() test_one("rt_p4", rt_p4, 33.0563, 1.0); test_one("rt_p5", rt_p5, 17, 1.0); test_one("rt_p6", rt_p6, 18.4853, 1.0); -#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) test_one("rt_p7", rt_p7, 26.2279, 1.0); -#endif test_one("rt_p8", rt_p8, 29.0563, 1.0); test_one("rt_p9", rt_p9, 26.1421, 1.0); test_one("rt_p10", rt_p10, 23.3995, 1.0); diff --git a/include/boost/geometry/algorithms/detail/get_left_turns.hpp b/include/boost/geometry/algorithms/detail/get_left_turns.hpp index 8f99fa347..527039fbe 100644 --- a/include/boost/geometry/algorithms/detail/get_left_turns.hpp +++ b/include/boost/geometry/algorithms/detail/get_left_turns.hpp @@ -24,351 +24,13 @@ namespace boost { namespace geometry namespace detail { -#ifdef BOOST_GEOMETRY_OLD_GET_LEFT_TURNS // TODO: move this to /util/ template -static inline std::pair ordered_pair(T const& first, T const& second) +inline std::pair ordered_pair(T const& first, T const& second) { return first < second ? std::make_pair(first, second) : std::make_pair(second, first); } -template -inline void debug_left_turn(AngleInfo const& ai, AngleInfo const& previous) -{ -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << "Angle: " << (ai.incoming ? "i" : "o") - << " " << si(ai.seg_id) - << " " << (math::r2d * (ai.angle) ) - << " turn: " << ai.turn_index << "[" << ai.operation_index << "]" - ; - - if (ai.turn_index != previous.turn_index - || ai.operation_index != previous.operation_index) - { - std::cout << " diff: " << math::r2d * math::abs(previous.angle - ai.angle); - } - std::cout << std::endl; -#endif -} - -template -inline void debug_left_turn(std::string const& caption, AngleInfo const& ai, AngleInfo const& previous, - int code = -99, int code2 = -99, int code3 = -99, int code4 = -99) -{ -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << " " << caption - << " turn: " << ai.turn_index << "[" << ai.operation_index << "]" - << " " << si(ai.seg_id) - << " " << (ai.incoming ? "i" : "o") - << " " << (math::r2d * (ai.angle) ) - << " turn: " << previous.turn_index << "[" << previous.operation_index << "]" - << " " << si(previous.seg_id) - << " " << (previous.incoming ? "i" : "o") - << " " << (math::r2d * (previous.angle) ) - ; - - if (code != -99) - { - std::cout << " code: " << code << " , " << code2 << " , " << code3 << " , " << code4; - } - std::cout << std::endl; -#endif -} - - -template -inline bool include_operation(Operation const& op, - segment_identifier const& outgoing_seg_id, - segment_identifier const& incoming_seg_id) -{ - return op.seg_id == outgoing_seg_id - && op.other_id == incoming_seg_id - && (op.operation == detail::overlay::operation_union - ||op.operation == detail::overlay::operation_continue) - ; -} - -template -inline bool process_include(segment_identifier const& outgoing_seg_id, segment_identifier const& incoming_seg_id, - int turn_index, Turn& turn, - std::set& keep_indices, int priority) -{ - bool result = false; - for (int i = 0; i < 2; i++) - { - if (include_operation(turn.operations[i], outgoing_seg_id, incoming_seg_id)) - { - turn.operations[i].include_in_occupation_map = true; - if (priority > turn.priority) - { - turn.priority = priority; - } - keep_indices.insert(turn_index); - result = true; - } - } - return result; -} - -template -inline bool include_left_turn_of_all( - AngleInfo const& outgoing, AngleInfo const& incoming, - Turns& turns, TurnSegmentIndices const& turn_segment_indices, - std::set& keep_indices, int priority) -{ - segment_identifier const& outgoing_seg_id = turns[outgoing.turn_index].operations[outgoing.operation_index].seg_id; - segment_identifier const& incoming_seg_id = turns[incoming.turn_index].operations[incoming.operation_index].seg_id; - - if (outgoing.turn_index == incoming.turn_index) - { - return process_include(outgoing_seg_id, incoming_seg_id, outgoing.turn_index, turns[outgoing.turn_index], keep_indices, priority); - } - - bool result = false; - std::pair pair = ordered_pair(outgoing_seg_id, incoming_seg_id); - typename boost::range_iterator::type it = turn_segment_indices.find(pair); - if (it != turn_segment_indices.end()) - { - for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit) - { - if (process_include(outgoing_seg_id, incoming_seg_id, *sit, turns[*sit], keep_indices, priority)) - { - result = true; - } - } - } - return result; -} - -template -inline bool corresponds(Turn const& turn, segment_identifier const& seg_id) -{ - return turn.operations[Index].operation == detail::overlay::operation_union - && turn.operations[Index].seg_id == seg_id; -} - - -template -inline bool prefer_by_other(Turns const& turns, - TurnSegmentIndices const& turn_segment_indices, - std::set& indices) -{ - std::map map; - for (std::set::const_iterator sit = indices.begin(); - sit != indices.end(); - ++sit) - { - map[turns[*sit].operations[0].seg_id]++; - map[turns[*sit].operations[1].seg_id]++; - } - - std::set segment_occuring_once; - for (std::map::const_iterator mit = map.begin(); - mit != map.end();++mit) - { - if (mit->second == 1) - { - segment_occuring_once.insert(mit->first); - } -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER - std::cout << si(mit->first) << " " << mit->second << std::endl; -#endif - } - - if (segment_occuring_once.size() == 2) - { - // Try to find within all turns a turn with these two segments - - std::set::const_iterator soo_it = segment_occuring_once.begin(); - segment_identifier front = *soo_it; - soo_it++; - segment_identifier back = *soo_it; - - std::pair pair = ordered_pair(front, back); - - typename boost::range_iterator::type it = turn_segment_indices.find(pair); - if (it != turn_segment_indices.end()) - { - // debug_turns_by_indices("Found", it->second); - // Check which is the union/continue - segment_identifier good; - for (std::set::const_iterator sit = it->second.begin(); sit != it->second.end(); ++sit) - { - if (turns[*sit].operations[0].operation == detail::overlay::operation_union) - { - good = turns[*sit].operations[0].seg_id; - } - else if (turns[*sit].operations[1].operation == detail::overlay::operation_union) - { - good = turns[*sit].operations[1].seg_id; - } - } - -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_PREFER - std::cout << "Good: " << si(good) << std::endl; -#endif - - // Find in indexes-to-keep this segment with the union. Discard the other one - std::set ok_indices; - for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit) - { - if (corresponds<0>(turns[*sit], good) || corresponds<1>(turns[*sit], good)) - { - ok_indices.insert(*sit); - } - } - if (ok_indices.size() > 0 && ok_indices.size() < indices.size()) - { - indices = ok_indices; - std::cout << "^"; - return true; - } - } - } - return false; -} - -template -inline void prefer_by_priority(Turns const& turns, std::set& indices) -{ - // Find max prio - int min_prio = 1024, max_prio = 0; - for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit) - { - if (turns[*sit].priority > max_prio) - { - max_prio = turns[*sit].priority; - } - if (turns[*sit].priority < min_prio) - { - min_prio = turns[*sit].priority; - } - } - - if (min_prio == max_prio) - { - return; - } - - // Only keep indices with high prio - std::set ok_indices; - for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit) - { - if (turns[*sit].priority >= max_prio) - { - ok_indices.insert(*sit); - } - } - if (ok_indices.size() > 0 && ok_indices.size() < indices.size()) - { - indices = ok_indices; - std::cout << "%"; - } -} - -template -inline void calculate_left_turns(Angles const& angles, - Turns& turns, TurnSegmentIndices const& turn_segment_indices, - std::set& keep_indices) -{ - bool debug_indicate_size = false; - - typedef typename strategy::side::services::default_strategy - < - typename cs_tag::type - >::type side_strategy; - - std::size_t i = 0; - std::size_t n = boost::size(angles); - - typedef geometry::ever_circling_range_iterator circling_iterator; - circling_iterator cit(angles); - - debug_left_turn(*cit, *cit); - for(circling_iterator prev = cit++; i < n; prev = cit++, i++) - { - debug_left_turn(*cit, *prev); - - bool const include = ! geometry::math::equals(prev->angle, cit->angle) - && ! prev->incoming - && cit->incoming; - - if (include) - { - // Go back to possibly include more same left outgoing angles: - // Because we check on side too we can take a large "epsilon" - circling_iterator back = prev - 1; - - typename AngleInfo::angle_type eps = 0.00001; - int b = 1; - for(std::size_t d = 0; - math::abs(prev->angle - back->angle) < eps - && ! back->incoming - && d < n; - d++) - { - --back; - ++b; - } - - // Same but forward to possibly include more incoming angles - int f = 1; - circling_iterator forward = cit + 1; - for(std::size_t d = 0; - math::abs(cit->angle - forward->angle) < eps - && forward->incoming - && d < n; - d++) - { - ++forward; - ++f; - } - -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << "HANDLE " << b << "/" << f << " ANGLES" << std::endl; -#endif - for(circling_iterator bit = prev; bit != back; --bit) - { - int code = side_strategy::apply(bit->direction_point, prev->intersection_point, prev->direction_point); - int code2 = side_strategy::apply(prev->direction_point, bit->intersection_point, bit->direction_point); - for(circling_iterator fit = cit; fit != forward; ++fit) - { - int code3 = side_strategy::apply(fit->direction_point, cit->intersection_point, cit->direction_point); - int code4 = side_strategy::apply(cit->direction_point, fit->intersection_point, fit->direction_point); - - int priority = 2; - if (code == -1 && code2 == 1) - { - // This segment is lying right of the other one. - // Cannot ignore it (because of robustness, see a.o. #rt_p21 from unit test). - // But if we find more we can prefer later by priority - // (a.o. necessary for #rt_o2 from unit test) - priority = 1; - } - - bool included = include_left_turn_of_all(*bit, *fit, turns, turn_segment_indices, keep_indices, priority); - debug_left_turn(included ? "KEEP" : "SKIP", *fit, *bit, code, code2, code3, code4); - } - } - } - } - - if (debug_indicate_size) - { - std::cout << " size=" << keep_indices.size(); - } - - if (keep_indices.size() >= 2) - { - prefer_by_other(turns, turn_segment_indices, keep_indices); - } - if (keep_indices.size() >= 2) - { - prefer_by_priority(turns, keep_indices); - } -} -#else - namespace left_turns { @@ -599,8 +261,6 @@ inline void block_turns_on_right_sides(AngleTurnCollection const& turns, } // namespace left_turns -#endif - } // namespace detail #endif // DOXYGEN_NO_DETAIL diff --git a/include/boost/geometry/algorithms/detail/occupation_info.hpp b/include/boost/geometry/algorithms/detail/occupation_info.hpp index 6a51e978b..c37e68f36 100644 --- a/include/boost/geometry/algorithms/detail/occupation_info.hpp +++ b/include/boost/geometry/algorithms/detail/occupation_info.hpp @@ -29,15 +29,6 @@ namespace boost { namespace geometry namespace detail { -template -inline T calculate_angle(P1 const& from_point, P2 const& to_point) -{ - typedef P1 vector_type; - vector_type v = from_point; - geometry::subtract_point(v, to_point); - return atan2(geometry::get<1>(v), geometry::get<0>(v)); -} - template < typename Iterator, @@ -78,9 +69,15 @@ struct angle_info int turn_index; int operation_index; Point intersection_point; - Point direction_point; - T angle; + Point point; // either incoming or outgoing point bool incoming; + bool blocked; + bool included; + + inline angle_info() + : blocked(false) + , included(false) + {} }; template @@ -88,55 +85,15 @@ class occupation_info { typedef std::vector collection_type; - struct angle_sort - { - inline bool operator()(AngleInfo const& left, AngleInfo const& right) const - { - // In this case we can compare even double using equals - // return geometry::math::equals(left.angle, right.angle) - return left.angle == right.angle - ? int(left.incoming) < int(right.incoming) - : left.angle < right.angle - ; - } - }; - public : collection_type angles; + std::vector > turns; int m_count; private : bool m_occupied; bool m_calculated; - inline bool is_occupied() - { - if (boost::size(angles) <= 1) - { - return false; - } - - std::sort(angles.begin(), angles.end(), angle_sort()); - - typedef geometry::closing_iterator closing_iterator; - closing_iterator vit(angles); - closing_iterator end(angles, true); - - closing_iterator prev = vit++; - for( ; vit != end; prev = vit++) - { - if (! geometry::math::equals(prev->angle, vit->angle) - && ! prev->incoming - && vit->incoming) - { - return false; - } - } - return true; - } -#endif - - public : inline occupation_info() : m_count(0) @@ -168,48 +125,33 @@ public : info.intersection_point = intersection_point; { - info.angle = calculate_angle(incoming_point, intersection_point); - info.direction_point = incoming_point; + info.point = incoming_point; info.incoming = true; angles.push_back(info); } { - info.angle = calculate_angle(outgoing_point, intersection_point); - info.direction_point = outgoing_point; + info.point = outgoing_point; info.incoming = false; angles.push_back(info); } + detail::left_turns::turn_angle_info turn(seg_id, incoming_point, outgoing_point); + turns.push_back(turn); m_calculated = false; } -#ifdef BOOST_GEOMETRY_OLD_GET_LEFT_TURNS - inline bool occupied() + template + inline void get_left_turns(RobustPoint const& origin, + std::vector& turns_to_keep) { - if (! m_calculated) - { - m_occupied = is_occupied(); - m_calculated = true; - } - return m_occupied; - } -#endif - - template - inline void get_left_turns( - Turns& turns, TurnSegmentIndices const& turn_segment_indices, - std::set& keep_indices) - { -#ifdef BOOST_GEOMETRY_OLD_GET_LEFT_TURNS - std::sort(angles.begin(), angles.end(), angle_sort()); - calculate_left_turns(angles, turns, turn_segment_indices, keep_indices); -#else // Sort on angle - std::sort(sorted.begin(), sorted.end(), detail::left_turns::angle_less(p)); + std::sort(angles.begin(), angles.end(), + detail::left_turns::angle_less(origin)); // Block all turns on the right side of any turn - detail::left_turns::block_turns_on_right_sides(angles, sorted); -#endif + detail::left_turns::block_turns_on_right_sides(turns, angles); + + detail::left_turns::get_left_turns(angles, origin, turns_to_keep); } }; diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffer_policies.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffer_policies.hpp index ad763c547..fe1823887 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffer_policies.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffer_policies.hpp @@ -82,7 +82,7 @@ struct turn_assign_for_buffer { static bool const include_no_turn = false; static bool const include_degenerate = false; - static bool const include_opposite = true; + static bool const include_opposite = false; template < diff --git a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp index 97e4cc2c0..90995ed01 100644 --- a/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/extensions/algorithms/buffer/buffered_piece_collection.hpp @@ -9,9 +9,6 @@ #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_PIECE_COLLECTION_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFERED_PIECE_COLLECTION_HPP -#define BOOST_GEOMETRY_OLD_GET_LEFT_TURNS - - #include #include #include @@ -191,14 +188,10 @@ struct buffered_piece_collection buffered_ring_collection traversed_rings; segment_identifier current_segment_id; - std::map, std::set > m_turn_indices_per_segment_pair; - RobustPolicy const& m_robust_policy; struct buffer_occupation_info : public occupation_info > { - std::set seg_ids; - std::set turn_indices; }; typedef std::map > occupation_map_type; @@ -343,143 +336,6 @@ struct buffered_piece_collection } - inline void debug_turns_by_indices(std::string const& caption, std::set const& indices) const - { -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << caption << ": " << indices.size() << std::endl; - for (std::set::const_iterator sit = indices.begin(); sit != indices.end(); ++sit) - { - int const index = *sit; - std::cout << "Keep " << index // << "[" << sit->second << "]" - << " "<< si(m_turns[index].operations[0].seg_id) - << " "<< si(m_turns[index].operations[1].seg_id) - << " " << m_turns[index].operations[0].piece_index - << "/" << m_turns[index].operations[1].piece_index - << " " << method_char(m_turns[index].method) - << " " << operation_char(m_turns[index].operations[0].operation) - << "/" << operation_char(m_turns[index].operations[1].operation) - << std::endl; - } -#endif - } - - inline void fill_segment_map() - { - m_turn_indices_per_segment_pair.clear(); - int index = 0; - for (typename boost::range_iterator::type it = - boost::begin(m_turns); it != boost::end(m_turns); ++it, ++index) - { - m_turn_indices_per_segment_pair - [ - ordered_pair - ( - m_turns[index].operations[0].seg_id, - m_turns[index].operations[1].seg_id - ) - ].insert(index); - } - } - - - // Sets "count_on_multi" (if not kept) or "piece_indices_to_skip" (if kept) - // for to avoid within operations for these pieces - inline void process_left_turns(buffer_occupation_info const& info, - std::set const& keep_indices) - { - for (std::set::const_iterator sit1 = info.turn_indices.begin(); - sit1 != info.turn_indices.end(); - ++sit1) - { - if (keep_indices.count(*sit1) == 0) - { - m_turns[*sit1].count_on_multi++; - } - else - { - for (std::set::const_iterator sit2 = info.turn_indices.begin(); - sit2 != info.turn_indices.end(); - ++sit2) - { - if (sit2 != sit1) - { - m_turns[*sit1].piece_indices_to_skip.insert(m_turns[*sit2].operations[0].piece_index); - m_turns[*sit1].piece_indices_to_skip.insert(m_turns[*sit2].operations[1].piece_index); - } - } - } - } - } - - inline void get_left_turns(buffer_occupation_info& info) - { - debug_turns_by_indices("Examine", info.turn_indices); - - std::set keep_indices; - info.get_left_turns(m_turns, m_turn_indices_per_segment_pair, keep_indices); - - if (! keep_indices.empty()) - { -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << "USE " << keep_indices.size() << " OF " << info.turn_indices.size() << " TURNS" << std::endl; -#endif - process_left_turns(info, keep_indices); - } - } - - inline int piece_count(buffer_occupation_info const& info) - { - std::set piece_indices; - - for (std::set::const_iterator sit = info.turn_indices.begin(); - sit != info.turn_indices.end(); - ++sit) - { - piece_indices.insert(m_turns[*sit].operations[0].piece_index); - piece_indices.insert(m_turns[*sit].operations[1].piece_index); - } - return piece_indices.size(); - } - - inline void classify_occupied_locations() - { - for (typename boost::range_iterator::type it = - boost::begin(m_occupation_map); - it != boost::end(m_occupation_map); ++it) - { - buffer_occupation_info& info = it->second; - -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << std::endl << "left turns: " << piece_count(info) << " " - //<< std::setprecision(20) - << geometry::wkt(it->first) << std::endl; -#endif - if (piece_count(info) > 2) - { - if (info.occupied()) - { -#ifdef BOOST_GEOMETRY_DEBUG_BUFFER_OCCUPATION - std::cout << "-> occupied" << std::endl; - - // std::set turn_indices; - //info.get_left_turns(it->first, m_turns, turn_indices, keep_indices); // just for debug-info -#endif - - for (std::set::const_iterator sit = info.turn_indices.begin(); - sit != info.turn_indices.end(); - ++sit) - { - m_turns[*sit].count_on_occupied++; - } - } - else - { - get_left_turns(info); - } - } - } - } - // The "get_left_turn" process indicates, if it is a u/u turn (both only applicable // for union, two separate turns), which is indicated in the map. If done so, set // the other to "none", it is part of an occupied situation and should not be followed. @@ -561,9 +417,11 @@ struct buffered_piece_collection { // 1: Add all intersection points to occupation map typedef typename boost::range_iterator::type + const_iterator_type; + typedef typename boost::range_iterator::type iterator_type; - for (iterator_type it = boost::begin(m_turns); + for (const_iterator_type it = boost::begin(m_turns); it != boost::end(m_turns); ++it) { @@ -586,7 +444,18 @@ struct buffered_piece_collection } } - // 3: Add angles for all point still present in the map + // 3: Add vectors (incoming->intersection-point, + // intersection-point -> outgoing) + // for all (co-located) points still present in the map + // and fill map segment_pair->turn_index + typedef + std::map + < + std::pair, + std::set + > segment_pair_map; + segment_pair_map turn_indices_per_segment_pair; + int index = 0; for (iterator_type it = boost::begin(m_turns); it != boost::end(m_turns); @@ -598,16 +467,77 @@ struct buffered_piece_collection if (mit != m_occupation_map.end()) { buffer_occupation_info& info = mit->second; + // a: for (int i = 0; i < 2; i++) { segment_identifier op_seg_id = it->operations[i].seg_id; - info.turn_indices.insert(index); - info.seg_ids.insert(op_seg_id); add_incoming_and_outgoing_angles(it->robust_point, offsetted_rings[op_seg_id.multi_index], m_robust_policy, index, i, op_seg_id, info); } + + it->count_on_multi++; + + turn_indices_per_segment_pair + [ + ordered_pair + ( + it->operations[0].seg_id, + it->operations[1].seg_id + ) + ].insert(index); + } + } + + // 4: From these vectors, get the left turns + // and mark all other turns as to-skip + for (iterator_type it = boost::begin(m_turns); + it != boost::end(m_turns); + ++it, ++index) + { + typename occupation_map_type::iterator mit = + m_occupation_map.find(it->robust_point); + + if (mit != m_occupation_map.end()) + { + buffer_occupation_info& info = mit->second; + + std::vector turns_to_keep; + info.get_left_turns(it->robust_point, turns_to_keep); + + if (turns_to_keep.empty()) + { + it->count_on_occupied++; + } + +#if 0 +// TODO: block non-left turns, keep left turns + for (std::vector::const_iterator + it = turns_to_keep.begin(); it != turns_to_keep.end(); ++it) + { + std::pair + pair = ordered_pair(it->from, it->to); + segment_pair_map::const_iterator segit + = turn_indices_per_segment_pair.find(pair); + if (segit == turn_indices_per_segment_pair.end()) + { + std::cout << "BAD LUCK" << std::endl; + } + else + { + std::cout << "FOUND IP" << std::endl; + for (std::set::const_iterator iit = segit->second.begin(); + iit != segit->second.end(); ++iit) + { + int turn_index = *iit; + //m_turns[turn_index].count_on_occupied++; + } + } + // Mark as included + + } +#endif } } } @@ -638,7 +568,7 @@ struct buffered_piece_collection inline bool classify_turn_inside(Turn const& turn) const { return turn.count_within > 0 - || turn.count_on_multi > 0 + // || turn.count_on_multi > 0 || turn.count_on_occupied > 0 ; } @@ -806,9 +736,7 @@ struct buffered_piece_collection rescale_pieces(); - fill_segment_map(); get_occupation(); - classify_occupied_locations(); process_uu(); classify_turns(); classify_inside();