Skip to content

Commit 271c5ad

Browse files
committed
[turns, buffer] add cases from robustness test going wrong, some fixed with start turn
1 parent 3e111a0 commit 271c5ad

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

test/algorithms/buffer/buffer_multi_polygon.cpp

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,52 @@ static std::string const rt_v3
292292
static std::string const rt_v4
293293
= "MULTIPOLYGON(((5 4,5 5,6 5,6 4,5 4)),((7 1,6 1,7 2,7 1)),((7 1,8 1,8 0,7 0,7 1)),((6 1,5 1,5 2,6 1)))";
294294

295+
// From 2020 runs of robustness test recursive_polygons_buffer, without rescaling
296+
// For the same problem there can be multiple cases, but details differ
297+
298+
// Cases missing a turn, or needing a start turn
299+
static std::string const nores_mt_1
300+
= "MULTIPOLYGON(((4 8,4 9,5 9,4 8)),((3 6,3 7,4 6,3 6)))";
301+
302+
static std::string const nores_mt_2
303+
= "MULTIPOLYGON(((5 3,6 4,6 3,5 3)),((4 4,3 4,4 5,5 5,4 4)),((4 5,3 5,3 6,4 5)))";
304+
305+
static std::string const nores_mt_3
306+
= "MULTIPOLYGON(((7 4,7 5,8 5,8 4,7 4)),((2 6,2 7,3 6,2 6)),((3 10,4 10,4 9,4 8,3 8,3 10)))";
307+
308+
static std::string const nores_mt_4
309+
= "MULTIPOLYGON(((6 8,6 9,7 9,6 8)),((1 5,1 6,2 6,1 5)),((7 7,8 8,8 7,7 7)),((0 3,0 4,1 3,0 3)))";
310+
311+
static std::string const nores_mt_5
312+
= "MULTIPOLYGON(((4 3,4 4,5 4,5 3,4 3)),((3 1,3 2,4 1,3 1)),((1 6,2 7,2 6,1 6)),((3 6,4 5,3 4,3 6)))";
313+
314+
static std::string const nores_mt_6
315+
= "MULTIPOLYGON(((5 7,5 6,4 6,4 5,4 4,3 4,3 6,3 7,5 7)))";
316+
317+
// Cases generating an extra turn, and/or a cluster not yet handled correctly
318+
static std::string const nores_et_1
319+
= "MULTIPOLYGON(((5 7,5 8,6 8,5 7)),((5 4,5 5,6 4,5 4)),((3 6,4 7,4 6,3 6)))";
320+
321+
static std::string const nores_et_2
322+
= "MULTIPOLYGON(((4 2,5 3,5 2,4 2)),((6 3,6 4,7 4,7 3,6 3)),((7 2,8 3,8 2,7 2)),((4 4,4 5,5 5,5 4,4 4)))";
323+
324+
static std::string const nores_et_3
325+
= "MULTIPOLYGON(((3 1,3 2,4 2,4 1,3 1)),((5 4,5 3,4 3,5 4)),((5 3,6 2,5 2,5 3)),((8 1,7 1,6 1,7 2,7 3,7.5 2.5,8 3,8 1)))";
326+
327+
static std::string const nores_et_4
328+
= "MULTIPOLYGON(((4 7,4 8,5 8,5 7,4 7)),((3 5,3 6,4 5,3 5)),((1 6,2 7,2 6,1 6)))";
329+
330+
static std::string const nores_et_5
331+
= "MULTIPOLYGON(((3 2,3 3,4 3,4 2,3 2)),((0 3,0 4,1 3,0 3)),((2 2,2 1,1 1,2 2)))";
332+
333+
334+
// Cases having wrong next turn information, somehow, taking the "i" (intersection),
335+
// which is wrong for buffer (it should take the "u" like union)
336+
static std::string const nores_wn_1
337+
= "MULTIPOLYGON(((8 3,8 4,9 4,9 3,8 3)),((9 5,9 6,10 5,9 5)),((8 8,9 9,9 8,8 8)),((8 8,8 7,7 7,8 8)))";
338+
static std::string const nores_wn_2
339+
= "MULTIPOLYGON(((9 5,9 6,10 5,9 5)),((8 8,8 7,7 7,7 8,8 8)),((8 8,9 9,9 8,8 8)))";
340+
295341

296342
static std::string const neighbouring
297343
= "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((10 10,10 20,20 20,20 10,10 10)))";
@@ -498,6 +544,23 @@ void test_all()
498544
test_one<multi_polygon_type, polygon_type>("rt_v3", rt_v3, join_round32, end_flat, 22.9158, 1.0);
499545
test_one<multi_polygon_type, polygon_type>("rt_v4", rt_v4, join_round32, end_flat, 23.4146, 1.0);
500546

547+
test_one<multi_polygon_type, polygon_type>("nores_mt_1", nores_mt_1, join_round32, end_flat, 13.4113, 1.0);
548+
test_one<multi_polygon_type, polygon_type>("nores_mt_2", nores_mt_2, join_round32, end_flat, 17.5265, 1.0);
549+
test_one<multi_polygon_type, polygon_type>("nores_mt_3", nores_mt_3, join_round32, end_flat, 25.6091, 1.0);
550+
test_one<multi_polygon_type, polygon_type>("nores_mt_4", nores_mt_4, join_round32, end_flat, 26.0946, 1.0);
551+
test_one<multi_polygon_type, polygon_type>("nores_mt_5", nores_mt_5, join_round32, end_flat, 26.4375, 1.0);
552+
test_one<multi_polygon_type, polygon_type>("nores_mt_6", nores_mt_6, join_round32, end_flat, 16.9018, 1.0);
553+
554+
#if defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
555+
test_one<multi_polygon_type, polygon_type>("nores_et_1", nores_et_1, join_round32, end_flat, 18.9866, 1.0);
556+
test_one<multi_polygon_type, polygon_type>("nores_et_2", nores_et_2, join_round32, end_flat, 23.8389, 1.0);
557+
test_one<multi_polygon_type, polygon_type>("nores_et_3", nores_et_3, join_round32, end_flat, 26.9030, 1.0);
558+
test_one<multi_polygon_type, polygon_type>("nores_et_4", nores_et_4, join_round32, end_flat, 19.9626, 1.0);
559+
test_one<multi_polygon_type, polygon_type>("nores_et_5", nores_et_5, join_round32, end_flat, 19.9615, 1.0);
560+
test_one<multi_polygon_type, polygon_type>("nores_wn_1", nores_wn_1, join_round32, end_flat, 23.7659, 1.0);
561+
test_one<multi_polygon_type, polygon_type>("nores_wn_2", nores_wn_2, join_round32, end_flat, 18.2669, 1.0);
562+
#endif
563+
501564
test_one<multi_polygon_type, polygon_type>("neighbouring_small",
502565
neighbouring,
503566
join_round32, end_round32, 128.0, -1.0);
@@ -541,7 +604,7 @@ int test_main(int, char* [])
541604
#endif
542605

543606
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
544-
BoostGeometryWriteExpectedFailures(1, 1, 2, 3);
607+
BoostGeometryWriteExpectedFailures(1, 14, 2, 11);
545608
#endif
546609

547610
return 0;

0 commit comments

Comments
 (0)