-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix fill extrusion querying for colinear points (#9454)
When checking for intersections with a fill-extrusion it has to calculate the distance to the plane the polygon exist on. If the first points of the geometry were colinear this calculation would fail. It now: - finds two distinct starting points a, b - loops over all the remaining vertices looking for a value that is not colinear with a, b Usually this will be the first vertex it encounters.
- Loading branch information
Showing
3 changed files
with
133 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/integration/query-tests/regressions/mapbox-gl-js#8999-2/expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[ | ||
{ | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-19.9951171875, | ||
-40.01078714046552 | ||
], | ||
[ | ||
-19.9951171875, | ||
40.01078714046551 | ||
], | ||
[ | ||
-19.9951171875, | ||
59.99898612060443 | ||
], | ||
[ | ||
19.9951171875, | ||
20.014645445341372 | ||
], | ||
[ | ||
-19.9951171875, | ||
-40.01078714046552 | ||
] | ||
] | ||
] | ||
}, | ||
"type": "Feature", | ||
"properties": { | ||
"layer": "extrusion_colinear_points" | ||
}, | ||
"source": "extrusion_colinear_points", | ||
"state": {} | ||
} | ||
] |
70 changes: 70 additions & 0 deletions
70
test/integration/query-tests/regressions/mapbox-gl-js#8999-2/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"debug": true, | ||
"width": 200, | ||
"height": 200, | ||
"queryGeometry": [ | ||
100, | ||
40 | ||
] | ||
} | ||
}, | ||
"pitch": 0, | ||
"center": [ | ||
0, | ||
0 | ||
], | ||
"zoom": 0, | ||
"sources": { | ||
"extrusion_colinear_points": { | ||
"type": "geojson", | ||
"tolerance": 0, | ||
"data": { | ||
"type": "Feature", | ||
"properties": { | ||
"layer": "extrusion_colinear_points" | ||
}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [ | ||
[ | ||
[ | ||
-20, | ||
-40 | ||
], | ||
[ | ||
-20, | ||
40 | ||
], | ||
[ | ||
-20, | ||
60 | ||
], | ||
[ | ||
20, | ||
20 | ||
], | ||
[ | ||
-20, | ||
-40 | ||
] | ||
] | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"layers": [ | ||
{ | ||
"id": "extrusion_colinear_points", | ||
"type": "fill-extrusion", | ||
"source": "extrusion_colinear_points", | ||
"paint": { | ||
"fill-extrusion-color": "#ecc", | ||
"fill-extrusion-height": 0 | ||
} | ||
} | ||
] | ||
} |