From 28a81421c45690c501c6ec487f2c23108f812beb Mon Sep 17 00:00:00 2001 From: Kenny Daniel Date: Wed, 4 Jan 2023 17:48:16 -0800 Subject: [PATCH] Additional test cases from rust-geo-booleanop --- test/genericTestCases/basic1_poly.geojson | 136 +++++++ .../basic3_multi_poly.geojson | 184 ++++++++++ test/genericTestCases/checkerboard1.geojson | 132 +++++++ .../collinear_segments1.geojson | 106 ++++++ .../daef_polygonwithholes_holed.geojson | 95 +++++ .../intersections_at_endpoints.geojson | 93 +++++ .../overlapping_segments1.geojson | 132 +++++++ .../overlapping_segments2.geojson | 336 ++++++++++++++++++ .../overlapping_segments3.geojson | 66 ++++ 9 files changed, 1280 insertions(+) create mode 100644 test/genericTestCases/basic1_poly.geojson create mode 100644 test/genericTestCases/basic3_multi_poly.geojson create mode 100644 test/genericTestCases/checkerboard1.geojson create mode 100644 test/genericTestCases/collinear_segments1.geojson create mode 100644 test/genericTestCases/daef_polygonwithholes_holed.geojson create mode 100644 test/genericTestCases/intersections_at_endpoints.geojson create mode 100644 test/genericTestCases/overlapping_segments1.geojson create mode 100644 test/genericTestCases/overlapping_segments2.geojson create mode 100644 test/genericTestCases/overlapping_segments3.geojson diff --git a/test/genericTestCases/basic1_poly.geojson b/test/genericTestCases/basic1_poly.geojson new file mode 100644 index 0000000..740e8b4 --- /dev/null +++ b/test/genericTestCases/basic1_poly.geojson @@ -0,0 +1,136 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [0, 0], + [0, 1], + [1, 1], + [1, 0], + [0, 0] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.25] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/basic3_multi_poly.geojson b/test/genericTestCases/basic3_multi_poly.geojson new file mode 100644 index 0000000..1f57025 --- /dev/null +++ b/test/genericTestCases/basic3_multi_poly.geojson @@ -0,0 +1,184 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [2, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0.25, 0.25], + [2.75, 0.25], + [2.75, 2.75], + [0.25, 2.75], + [0.25, 0.25] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0.25, 0.25], + [1, 0.25], + [1, 1], + [0.25, 1], + [0.25, 0.25] + ] + ], + [ + [ + [2, 2], + [2.75, 2], + [2.75, 2.75], + [2, 2.75], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "intersection" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75], + [0.25, 2.75], + [0.25, 1], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "diff" + }, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [1, 0.25], + [0.25, 0.25], + [0.25, 1], + [0, 1], + [0, 0] + ] + ], + [ + [ + [0.25, 1], + [1, 1], + [1, 0.25], + [2.75, 0.25], + [2.75, 2], + [2, 2], + [2, 2.75], + [0.25, 2.75], + [0.25, 1] + ] + ], + [ + [ + [2, 2.75], + [2.75, 2.75], + [2.75, 2], + [3, 2], + [3, 3], + [2, 3], + [2, 2.75] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/checkerboard1.geojson b/test/genericTestCases/checkerboard1.geojson new file mode 100644 index 0000000..9c55a5a --- /dev/null +++ b/test/genericTestCases/checkerboard1.geojson @@ -0,0 +1,132 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [0, 1], + [1, 1], + [1, 0], + [0, 0] + ] + ], + [ + [ + [0, 2], + [0, 3], + [1, 3], + [1, 2], + [0, 2] + ] + ], + [ + [ + [1, 1], + [1, 2], + [2, 2], + [2, 1], + [1, 1] + ] + ], + [ + [ + [2, 0], + [2, 1], + [3, 1], + [3, 0], + [2, 0] + ] + ], + [ + [ + [2, 2], + [2, 3], + [3, 3], + [3, 2], + [2, 2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 1], + [0, 2], + [1, 2], + [1, 1], + [0, 1] + ] + ], + [ + [ + [1, 0], + [1, 1], + [2, 1], + [2, 0], + [1, 0] + ] + ], + [ + [ + [1, 2], + [1, 3], + [2, 3], + [2, 2], + [1, 2] + ] + ], + [ + [ + [2, 1], + [2, 2], + [3, 2], + [3, 1], + [2, 1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [1, 0], + [2, 0], + [3, 0], + [3, 1], + [3, 2], + [3, 3], + [2, 3], + [1, 3], + [0, 3], + [0, 2], + [0, 1], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/collinear_segments1.geojson b/test/genericTestCases/collinear_segments1.geojson new file mode 100644 index 0000000..ecb5db5 --- /dev/null +++ b/test/genericTestCases/collinear_segments1.geojson @@ -0,0 +1,106 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [0, 0.25], + [0, 0.5], + [0, 0.75], + [0, 1], + [0.25, 1], + [0.5, 1], + [0.75, 1], + [1, 1], + [1, 0.75], + [1, 0.5], + [1, 0.25], + [1, 0], + [0.75, 0], + [0.5, 0], + [0.25, 0], + [0, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0.25], + [0, 0.5], + [0, 0.75], + [0, 1], + [0, 1.25], + [0.25, 1.25], + [0.5, 1.25], + [0.75, 1.25], + [1, 1.25], + [1, 1], + [1, 0.75], + [1, 0.5], + [1, 0.25], + [0.75, 0.25], + [0.5, 0.25], + [0.25, 0.25], + [0, 0.25] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [0.25, 0], + [0.5, 0], + [0.75, 0], + [1, 0], + [1, 0.25], + [0.75, 0.25], + [0.5, 0.25], + [0.25, 0.25], + [0, 0.25], + [0, 0] + ] + ], + [ + [ + [0, 1], + [0.25, 1], + [0.5, 1], + [0.75, 1], + [1, 1], + [1, 1.25], + [0.75, 1.25], + [0.5, 1.25], + [0.25, 1.25], + [0, 1.25], + [0, 1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/daef_polygonwithholes_holed.geojson b/test/genericTestCases/daef_polygonwithholes_holed.geojson new file mode 100644 index 0000000..b7c77a3 --- /dev/null +++ b/test/genericTestCases/daef_polygonwithholes_holed.geojson @@ -0,0 +1,95 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [0, 0], + [300, 0], + [150, 300], + [0, 0] + ], + [ + [50, 50], + [150, 250], + [250, 50], + [50, 50] + ], + [ + [100, 100], + [200, 100], + [150, 200], + [100, 100] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [0, 0], + [300, 0], + [150, 300], + [0, 0], + [0, 300], + [0, 0] + ], + [ + [60, 60], + [150, 240], + [240, 60], + [60, 60] + ] + ], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [0, 0], + [0, 300], + [0, 0] + ] + ], + [ + [ + [50, 50], + [250, 50], + [150, 250], + [50, 50] + ], + [ + [60, 60], + [240, 60], + [150, 240], + [60, 60] + ] + ], + [ + [ + [100, 100], + [200, 100], + [150, 200], + [100, 100] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/intersections_at_endpoints.geojson b/test/genericTestCases/intersections_at_endpoints.geojson new file mode 100644 index 0000000..b76a0a4 --- /dev/null +++ b/test/genericTestCases/intersections_at_endpoints.geojson @@ -0,0 +1,93 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [-9, 10], + [9, 10], + [0.1, 0.1], + [10, 9], + [10, -9], + [0.1, -0.1], + [9, -10], + [-9, -10], + [-0.1, -0.1], + [-10, -9], + [-10, 9], + [-0.1, 0.1], + [-9, 10] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [-8.99999, 10], + [8.99999, 10], + [0.1, 0.1], + [10, 8.99999], + [10, -8.99999], + [0.1, -0.1], + [8.99999, -10], + [-8.99999, -10], + [-0.1, -0.1], + [-10, -8.99999], + [-10, 8.99999], + [-0.1, 0.1], + [-8.99999, 10] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [-10, -9], + [-0.1, -0.1], + [-9, -10], + [-8.99999, -10], + [8.99999, -10], + [9, -10], + [0.1, -0.1], + [10, -9], + [10, -8.99999], + [10, 8.99999], + [10, 9], + [0.1, 0.1], + [9, 10], + [8.99999, 10], + [-8.99999, 10], + [-9, 10], + [-0.1, 0.1], + [-10, 9], + [-10, 8.99999], + [-10, -8.99999], + [-10, -9] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/overlapping_segments1.geojson b/test/genericTestCases/overlapping_segments1.geojson new file mode 100644 index 0000000..fe552fe --- /dev/null +++ b/test/genericTestCases/overlapping_segments1.geojson @@ -0,0 +1,132 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [10, 10], + [15, 10], + [15, 20], + [10, 10] + ] + ], + [ + [ + [10, -10], + [15, -10], + [15, -20], + [10, -10] + ] + ], + [ + [ + [20, 10], + [25, 10], + [25, 20], + [20, 10] + ] + ], + [ + [ + [20, -10], + [25, -10], + [25, -20], + [20, -10] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [10, 10], + [15, 10], + [15, 15], + [10, 10] + ] + ], + [ + [ + [10, -10], + [15, -10], + [15, -15], + [10, -10] + ] + ], + [ + [ + [20, 10], + [25, 10], + [25, 5], + [20, 10] + ] + ], + [ + [ + [20, -10], + [25, -10], + [25, -5], + [20, -10] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [10, -10], + [15, -20], + [15, -15], + [10, -10] + ] + ], + [ + [ + [10, 10], + [15, 15], + [15, 20], + [10, 10] + ] + ], + [ + [ + [20, -10], + [25, -20], + [25, -10], + [25, -5], + [20, -10] + ] + ], + [ + [ + [20, 10], + [25, 5], + [25, 10], + [25, 20], + [20, 10] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "xor" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/overlapping_segments2.geojson b/test/genericTestCases/overlapping_segments2.geojson new file mode 100644 index 0000000..0ea8081 --- /dev/null +++ b/test/genericTestCases/overlapping_segments2.geojson @@ -0,0 +1,336 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [2, -1], + [2, 1], + [3, 1], + [3, -1], + [2, -1] + ] + ], + [ + [ + [4, -1], + [4, 1], + [5, 1], + [5, -1], + [4, -1] + ] + ], + [ + [ + [6, -1], + [6, 1], + [7, 1], + [7, -1], + [6, -1] + ] + ], + [ + [ + [8, -1], + [8, 1], + [9, 1], + [9, -1], + [8, -1] + ] + ], + [ + [ + [10, -1], + [10, 1], + [11, 1], + [11, -1], + [10, -1] + ] + ], + [ + [ + [12, -1], + [12, 1], + [13, 1], + [13, -1], + [12, -1] + ] + ], + [ + [ + [14, -1], + [14, 1], + [15, 1], + [15, -1], + [14, -1] + ] + ], + [ + [ + [16, -1], + [16, 1], + [17, 1], + [17, -1], + [16, -1] + ] + ], + [ + [ + [18, -1], + [18, 1], + [19, 1], + [19, -1], + [18, -1] + ] + ], + [ + [ + [20, -1], + [20, 1], + [21, 1], + [21, -1], + [20, -1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [2, 1], + [2, 2], + [2.5, 2], + [2.5, 1], + [2, 1] + ] + ], + [ + [ + [4.5, 1], + [4.5, 2], + [5, 2], + [5, 1], + [4.5, 1] + ] + ], + [ + [ + [6.25, 1], + [6.25, 2], + [6.75, 2], + [6.75, 1], + [6.25, 1] + ] + ], + [ + [ + [8, 1], + [8, 2], + [9, 2], + [9, 1], + [8, 1] + ] + ], + [ + [ + [9.5, 1], + [9.5, 2], + [10.5, 2], + [10.5, 1], + [9.5, 1] + ] + ], + [ + [ + [12, -1], + [12, -2], + [12.5, -2], + [12.5, -1], + [12, -1] + ] + ], + [ + [ + [14.5, -1], + [14.5, -2], + [15, -2], + [15, -1], + [14.5, -1] + ] + ], + [ + [ + [16.25, -1], + [16.25, -2], + [16.75, -2], + [16.75, -1], + [16.25, -1] + ] + ], + [ + [ + [18, -1], + [18, -2], + [19, -2], + [19, -1], + [18, -1] + ] + ], + [ + [ + [19.5, -1], + [19.5, -2], + [20.5, -2], + [20.5, -1], + [19.5, -1] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [2, -1], + [3, -1], + [3, 1], + [2.5, 1], + [2.5, 2], + [2, 2], + [2, 1], + [2, -1] + ] + ], + [ + [ + [4, -1], + [5, -1], + [5, 1], + [5, 2], + [4.5, 2], + [4.5, 1], + [4, 1], + [4, -1] + ] + ], + [ + [ + [6, -1], + [7, -1], + [7, 1], + [6.75, 1], + [6.75, 2], + [6.25, 2], + [6.25, 1], + [6, 1], + [6, -1] + ] + ], + [ + [ + [8, -1], + [9, -1], + [9, 1], + [9, 2], + [8, 2], + [8, 1], + [8, -1] + ] + ], + [ + [ + [9.5, 1], + [10, 1], + [10, -1], + [11, -1], + [11, 1], + [10.5, 1], + [10.5, 2], + [9.5, 2], + [9.5, 1] + ] + ], + [ + [ + [12, -2], + [12.5, -2], + [12.5, -1], + [13, -1], + [13, 1], + [12, 1], + [12, -1], + [12, -2] + ] + ], + [ + [ + [14, -1], + [14.5, -1], + [14.5, -2], + [15, -2], + [15, -1], + [15, 1], + [14, 1], + [14, -1] + ] + ], + [ + [ + [16, -1], + [16.25, -1], + [16.25, -2], + [16.75, -2], + [16.75, -1], + [17, -1], + [17, 1], + [16, 1], + [16, -1] + ] + ], + [ + [ + [18, -2], + [19, -2], + [19, -1], + [19, 1], + [18, 1], + [18, -1], + [18, -2] + ] + ], + [ + [ + [19.5, -2], + [20.5, -2], + [20.5, -1], + [21, -1], + [21, 1], + [20, 1], + [20, -1], + [19.5, -1], + [19.5, -2] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +} diff --git a/test/genericTestCases/overlapping_segments3.geojson b/test/genericTestCases/overlapping_segments3.geojson new file mode 100644 index 0000000..37b6ecb --- /dev/null +++ b/test/genericTestCases/overlapping_segments3.geojson @@ -0,0 +1,66 @@ +{ + "features": [ + { + "geometry": { + "coordinates": [ + [ + [ + [384, 0], + [416, 0], + [448, 0], + [448, 32], + [416, 32], + [384, 32], + [384, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [400, 32], + [416, 32], + [416, 48], + [400, 32] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [ + [ + [ + [384, 0], + [416, 0], + [448, 0], + [448, 32], + [416, 32], + [416, 48], + [400, 32], + [384, 32], + [384, 0] + ] + ] + ], + "type": "MultiPolygon" + }, + "properties": { + "operation": "union" + }, + "type": "Feature" + } + ], + "type": "FeatureCollection" +}