mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
[buffer] fix last cases, in cases where the same offsetted ring is self-intersecting,
the approach using multi_index does not work. We need an extra idenfication to check the 'sources' of the turns in clusters. Added piece_index for this purpose. This can be templated later (so only used for buffer)
This commit is contained in:
parent
438ee64956
commit
dfda1ccbc3
@ -941,8 +941,12 @@ struct buffered_piece_collection
|
||||
piece pc;
|
||||
pc.type = type;
|
||||
pc.index = static_cast<signed_size_type>(boost::size(m_pieces));
|
||||
|
||||
current_segment_id.piece_index = pc.index;
|
||||
|
||||
pc.first_seg_id = current_segment_id;
|
||||
|
||||
|
||||
// Assign left/right (for first/last piece per ring they will be re-assigned later)
|
||||
pc.left_index = pc.index - 1;
|
||||
pc.right_index = pc.index + 1;
|
||||
|
@ -38,6 +38,7 @@ struct segment_identifier
|
||||
, multi_index(-1)
|
||||
, ring_index(-1)
|
||||
, segment_index(-1)
|
||||
, piece_index(-1)
|
||||
{}
|
||||
|
||||
inline segment_identifier(signed_size_type src,
|
||||
@ -48,6 +49,7 @@ struct segment_identifier
|
||||
, multi_index(mul)
|
||||
, ring_index(rin)
|
||||
, segment_index(seg)
|
||||
, piece_index(-1)
|
||||
{}
|
||||
|
||||
inline bool operator<(segment_identifier const& other) const
|
||||
@ -85,6 +87,9 @@ struct segment_identifier
|
||||
signed_size_type multi_index;
|
||||
signed_size_type ring_index;
|
||||
signed_size_type segment_index;
|
||||
|
||||
// For buffer - todo: move this to buffer-only
|
||||
signed_size_type piece_index;
|
||||
};
|
||||
|
||||
|
||||
|
@ -278,7 +278,7 @@ struct side_sorter
|
||||
std::map<signed_size_type, bool> handled;
|
||||
find_open_generic
|
||||
<
|
||||
&segment_identifier::multi_index
|
||||
&segment_identifier::piece_index
|
||||
>(handled);
|
||||
}
|
||||
else
|
||||
|
@ -175,10 +175,8 @@ void test_all()
|
||||
test_one<linestring, polygon>("overlapping_asym_150_100", overlapping, join_miter, end_flat, 64.984, 1.5, 1.0);
|
||||
|
||||
// Having flat end
|
||||
#ifdef BOOST_GEOMETRY_TEST_FAIL_TANGENCIES
|
||||
test_one<linestring, polygon>("for_collinear", for_collinear, join_round, end_flat, 68.561, 2.0, 2.0);
|
||||
test_one<linestring, polygon>("for_collinear", for_collinear, join_miter, end_flat, 72, 2.0, 2.0);
|
||||
#endif
|
||||
#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS)
|
||||
test_one<linestring, polygon>("for_collinear2", for_collinear2, join_round, end_flat, 74.387, 2.0, 2.0);
|
||||
test_one<linestring, polygon>("for_collinear2", for_collinear2, join_miter, end_flat, 78.0, 2.0, 2.0);
|
||||
|
@ -355,9 +355,7 @@ void test_all()
|
||||
test_one<multi_polygon_type, polygon_type>("degenerate1", degenerate1, join_round, end_flat, 5.708, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("degenerate2", degenerate2, join_round, end_flat, 133.0166, 0.75);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_TEST_FAIL_TANGENCIES
|
||||
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_round, end_flat, 34.5381, 1.0);
|
||||
#endif
|
||||
test_one<multi_polygon_type, polygon_type>("rt_a", rt_a, join_miter, end_flat, 36, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_round, end_flat, 31.4186, 1.0);
|
||||
test_one<multi_polygon_type, polygon_type>("rt_b", rt_b, join_miter, end_flat, 34, 1.0);
|
||||
|
@ -358,9 +358,7 @@ void test_all()
|
||||
test_one<polygon_type, polygon_type>("gammagate1", gammagate, join_miter, end_flat, 88, 1);
|
||||
test_one<polygon_type, polygon_type>("fork_a1", fork_a, join_miter, end_flat, 88, 1);
|
||||
test_one<polygon_type, polygon_type>("fork_b1", fork_b, join_miter, end_flat, 154, 1);
|
||||
#ifdef BOOST_GEOMETRY_TEST_FAIL_TANGENCIES
|
||||
test_one<polygon_type, polygon_type>("fork_c1", fork_c, join_miter, end_flat, 152, 1);
|
||||
#endif
|
||||
test_one<polygon_type, polygon_type>("triangle", triangle, join_miter, end_flat, 14.6569, 1.0);
|
||||
|
||||
test_one<polygon_type, polygon_type>("degenerate0", degenerate0, join_round, end_round, 0.0, 1.0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user