mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-20 02:42:10 +00:00
[test] add validity flag for intersection and adapt input #outputs/#points
This commit is contained in:
@@ -54,6 +54,10 @@ void test_areal()
|
||||
bool const ccw = bg::point_order<Polygon>::value == bg::counterclockwise;
|
||||
bool const open = bg::closure<Polygon>::value == bg::open;
|
||||
|
||||
ut_settings ignore_validity;
|
||||
ignore_validity.test_validity = false;
|
||||
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("simplex_with_empty_1",
|
||||
simplex_normal[0], polygon_empty,
|
||||
0, 0, 0.0);
|
||||
@@ -167,17 +171,17 @@ void test_areal()
|
||||
pie_2_3_23_0[0], pie_2_3_23_0[1],
|
||||
1, 4, 163292.679042133, ut_settings(0.1));
|
||||
|
||||
// SQL Server gives: 88.1920416352664
|
||||
// PostGIS gives: 88.19203677911
|
||||
test_one<Polygon, Polygon, Polygon>("isovist",
|
||||
isovist1[0], isovist1[1],
|
||||
1, 19, 88.19203,
|
||||
ut_settings(if_typed_tt<ct>(0.01, 0.1)));
|
||||
|
||||
// SQL Server gives: 88.1920416352664
|
||||
// PostGIS gives: 88.19203677911
|
||||
|
||||
test_one<Polygon, Polygon, Polygon>("geos_1",
|
||||
geos_1[0], geos_1[1],
|
||||
1, -1, 3461.0214843, ut_settings(0.005)); // MSVC 14 reports 3461.025390625
|
||||
1, -1, 3461.0214843, // MSVC 14 reports 3461.025390625
|
||||
ut_settings(0.005, false));
|
||||
|
||||
// Expectations:
|
||||
// In most cases: 0 (no intersection)
|
||||
@@ -622,6 +626,9 @@ void test_all()
|
||||
typedef bg::model::polygon<P, false, false> polygon_ccw_open;
|
||||
boost::ignore_unused<polygon_ccw, polygon_open, polygon_ccw_open>();
|
||||
|
||||
ut_settings ignore_validity;
|
||||
ignore_validity.test_validity = false;
|
||||
|
||||
std::string clip = "box(2 2,8 8)";
|
||||
|
||||
test_areal_linear<polygon, linestring>();
|
||||
@@ -674,8 +681,7 @@ void test_all()
|
||||
test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0.0);
|
||||
|
||||
// Touching with point (-> output linestring with ONE point)
|
||||
//std::cout << "Note: the output line is degenerate! Might be removed!" << std::endl;
|
||||
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0);
|
||||
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0, ignore_validity);
|
||||
|
||||
// Along border
|
||||
test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6.0);
|
||||
|
||||
@@ -37,6 +37,9 @@
|
||||
template <typename Ring, typename Polygon, typename MultiPolygon>
|
||||
void test_areal()
|
||||
{
|
||||
ut_settings ignore_validity;
|
||||
ignore_validity.test_validity = false;
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("simplex_multi",
|
||||
case_multi_simplex[0], case_multi_simplex[1],
|
||||
2, 12, 6.42);
|
||||
@@ -105,13 +108,15 @@ void test_areal()
|
||||
3, 14, 2.85);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_72_multi_inv_b",
|
||||
case_72_multi[1], case_72_multi[2],
|
||||
3, 16, 6.15);
|
||||
3, 16, 6.15,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_77_multi",
|
||||
case_77_multi[0], case_77_multi[1],
|
||||
5, 33, 9.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_78_multi",
|
||||
case_78_multi[0], case_78_multi[1],
|
||||
1, 0, 22.0); // In "get_turns" using partitioning, #points went from 17 to 16
|
||||
1, 16, 22.0,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_101_multi",
|
||||
case_101_multi[0], case_101_multi[1],
|
||||
4, 22, 4.75);
|
||||
@@ -120,7 +125,8 @@ void test_areal()
|
||||
3, 26, 19.75);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_102_multi_inv_b",
|
||||
case_102_multi[1], case_102_multi[2],
|
||||
6, 25, 3.75);
|
||||
3, 25, 3.75,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_107_multi",
|
||||
case_107_multi[0], case_107_multi[1],
|
||||
2, 10, 1.5);
|
||||
@@ -137,17 +143,20 @@ void test_areal()
|
||||
#endif
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_1",
|
||||
case_recursive_boxes_1[0], case_recursive_boxes_1[1],
|
||||
10, 97, 47.0);
|
||||
8, 97, 47.0,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_2",
|
||||
case_recursive_boxes_2[0], case_recursive_boxes_2[1],
|
||||
1, 47, 90.0); // Area from SQL Server
|
||||
1, 50, 90.0, // Area from SQL Server
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_3",
|
||||
case_recursive_boxes_3[0], case_recursive_boxes_3[1],
|
||||
19, 87, 12.5); // Area from SQL Server
|
||||
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_4",
|
||||
case_recursive_boxes_4[0], case_recursive_boxes_4[1],
|
||||
13, 157, 67.0); // Area from SQL Server
|
||||
8, 174, 67.0, // Area from SQL Server
|
||||
ignore_validity);
|
||||
|
||||
// Fixed by replacing handle_tangencies in less_by_segment_ratio sort order
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_6",
|
||||
@@ -188,7 +197,7 @@ void test_areal()
|
||||
9, 43, 10.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_17",
|
||||
case_recursive_boxes_17[0], case_recursive_boxes_17[1],
|
||||
6, -1, 7.75);
|
||||
7, -1, 7.75);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_18",
|
||||
case_recursive_boxes_18[0], case_recursive_boxes_18[1],
|
||||
0, 0, 0.0);
|
||||
@@ -239,10 +248,12 @@ void test_areal()
|
||||
3, 0, 2.0);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_34",
|
||||
case_recursive_boxes_34[0], case_recursive_boxes_34[1],
|
||||
2, 0, 17.25);
|
||||
2, 0, 17.25,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_35",
|
||||
case_recursive_boxes_35[0], case_recursive_boxes_35[1],
|
||||
2, 0, 20.0);
|
||||
1, 0, 20.0,
|
||||
ignore_validity);
|
||||
test_one<Polygon, MultiPolygon, MultiPolygon>("case_recursive_boxes_36",
|
||||
case_recursive_boxes_36[0], case_recursive_boxes_36[1],
|
||||
1, 0, 0.5);
|
||||
|
||||
@@ -48,9 +48,9 @@ struct ut_settings
|
||||
bool test_validity;
|
||||
bool debug;
|
||||
|
||||
explicit ut_settings(double p = 0.0001)
|
||||
explicit ut_settings(double p = 0.0001, bool tv = true)
|
||||
: percentage(p)
|
||||
, test_validity(false)
|
||||
, test_validity(tv)
|
||||
, debug(false)
|
||||
{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user