Skip to content

Commit

Permalink
[test] add cases for issues boostorg#869 and boostorg#861
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels authored and vissarion committed Jun 30, 2021
1 parent 52422a4 commit a449a63
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
21 changes: 21 additions & 0 deletions test/algorithms/overlay/multi_overlay_cases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,27 @@ static std::string issue_643[2] =
"MULTIPOLYGON(((4.75985680877701196159479187986e-16 -0.26112514220036736611874061964,0 0,0.72337592336357892097709054724 0.600648602980154100450249643472,1.223386680467822174023240222 1.19163154396839887638748223253,1.72339743757206620422550713556 2.1342216197599452875977021904,1.72339742847305732453833115869 -2.01889900623749607433410346857,4.75985680877701196159479187986e-16 -0.26112514220036736611874061964)))"
};

// For difference
static std::string issue_869_a[2] =
{
"MULTIPOLYGON(((70 50,70 10,10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50)))",
"MULTIPOLYGON(((50 50,50 70,70 70,70 50,50 50)),((50 50,50 30,30 30,30 50,50 50)))"
};

// For union
static std::string issue_869_b[2] =
{
"MULTIPOLYGON(((10 10,10 70,50 70,50 50,70 50,70 10,10 10),(30 30,50 30,50 50,30 50,30 30)))",
"MULTIPOLYGON(((50 70,50 90,70 90,70 70,50 70)),((70 70,90 70,90 50,70 50,70 70)))"
};

// For intersection
static std::string issue_869_c[2] =
{
"MULTIPOLYGON(((10 10,10 90,90 90,90 10,10 10),(30 30,50 30,50 50,30 50,30 30),(50 50,70 50,70 70,50 70,50 50)))",
"MULTIPOLYGON(((10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50,70 10,10 10)))"
};

static std::string bug_21155501[2] =
{
"MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))",
Expand Down
6 changes: 6 additions & 0 deletions test/algorithms/overlay/overlay_cases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,12 @@ static std::string issue_838[2] =
"POLYGON((27164.783474018484 -40044.371515841653,27165.010815897258 -40044.854409784071,27162.750625155277 -40045.918184556889,27162.523283276503 -40045.43529061447,27164.783474018484 -40044.371515841653))"
};

static std::string issue_861[2] =
{
"POLYGON((0.000000000000000000000000000000 1.000000000000000000000000000000 , 1.000001713207607556554989969300 -0.000001713207607420577826331251 , 0.000000000000000000000000000000 0.230455148580528512702869647910 , 0.000000000000000000000000000000 1.000000000000000000000000000000))",
"POLYGON((0.999994299999858893279736093973 0.000000000000000000000000000000 , 0.239056281157559169514570385218 0.000000000000000000000000000000 , 0.073239184141848157061360780062 0.213576637616646664019626200570 , 0.999994299999858893279736093973 0.000000000000000000000000000000))"
};

static std::string ggl_list_20120229_volker[3] =
{
"POLYGON((1716 1554,2076 2250,2436 2352,2796 1248,3156 2484,3516 2688,3516 2688,3156 2484,2796 1248,2436 2352,2076 2250, 1716 1554))",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ void test_areal()
#endif
}

#if defined(BOOST_GEOMETRY_TEST_FAILURES)
// Generates a polygon with two interiors, i/o a multipoly with 3 rings
TEST_DIFFERENCE(issue_869_a, 3, 3600, 0, 0, 1);
#endif
// Areas and #clips correspond with POSTGIS (except sym case)
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
case_101_multi[0], case_101_multi[1],
Expand Down
5 changes: 5 additions & 0 deletions test/algorithms/set_operations/intersection/intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ void test_areal()

TEST_INTERSECTION(issue_838, 1, -1, (expectation_limits{0.6582, 0.6650}));

#if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
// With rescaling the output is wrong
TEST_INTERSECTION(issue_861, 1, -1, 1.4715007684573677693e-10);
#endif

test_one<Polygon, Polygon, Polygon>("buffer_mp1", buffer_mp1[0], buffer_mp1[1],
1, 31, 2.271707796);
test_one<Polygon, Polygon, Polygon>("buffer_mp2", buffer_mp2[0], buffer_mp2[1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,9 @@ void test_areal()
TEST_INTERSECTION(issue_643, 1, -1, 3.4615);
#endif

test_one<Polygon, MultiPolygon, MultiPolygon>("mysql_23023665_7",
mysql_23023665_7[0], mysql_23023665_7[1],
2, 11, 9.80505786783);
TEST_INTERSECTION(issue_869_c, 3, -1, 3600);

TEST_INTERSECTION(mysql_23023665_7, 2, 11, 9.80505786783);
TEST_INTERSECTION(mysql_23023665_12, 2, 0, 11.812440191387557);
TEST_INTERSECTION(mysql_regression_1_65_2017_08_31, 2, -1, 29.9022122);
}
Expand Down
5 changes: 5 additions & 0 deletions test/algorithms/set_operations/union/union_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ void test_areal()
TEST_UNION(issue_643, 1, 0, -1, 80.0);
#endif

// It returns 3 polygons, the first with an interior
// This is correct (the difference, resulting in the same spatial coverage,
// generates only one polygon with two interiors)
TEST_UNION(issue_869_b, 3, 1, -1, 3600);

#if defined(BOOST_GEOMETRY_USE_KRAMER_RULE)
// Two polygons, should ideally be merged
TEST_UNION(mail_2019_01_21_johan, 2, 0, -1, 0.00058896);
Expand Down

0 comments on commit a449a63

Please sign in to comment.