-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In-browser polygon tesselation #948
Conversation
@ansis you can try out the indexed approach using earcut Earcut returns |
@mourner Modulo fixing the tests, is this good to merge as-is, leaving investigation of the indexed approach as a follow-up ticket? |
@jfirebaugh no, mapbox/mapnik-vector-tile#59 is a blocker — we need to ditch unreliable ring classification hack, otherwise low zoom levels (<7) are completely broken. |
Is that something we need to worry about for user supplied GeoJSON as well? |
@jfirebaugh no, because GeoJSON spec explicitly defines the first ring as outer and other rings as holes for each polygon, and differentiates between polygons in a multipolygon. |
@mourner It looks like -native already assumes winding order is clockwise for outer rings and counterclockwise for holes: https://github.com/mapbox/mapbox-gl-native/blob/47966a143176a337733fe63b4121d2d00c48359a/src/mbgl/renderer/fill_bucket.cpp#L98 Is fixing the order of rings all that we need? mapbox/mapnik-vector-tile#59 (comment) Do we also need better clipping/unioning in the vector tiles? |
@ansis we need to try this. It may produce incorrect ring classification sometimes due to degeneracies — points can belong to several rings at once. This problem is solved by doing a union in native, but we can't afford operations like this in JS because they're expensive (probably more expensive than triangulation). Once we can classify rings reliably, cleaner geometries (union, etc. mapbox/mapnik-vector-tile#53) will be nice to solve minor artifacts on bad data, but not a blocker. |
Rendering performance noticeably improves. Tesselation is slow though: 100-500ms for the buildings layer.
I'll probably squash the PR into 2 commits, the first one and the rest. Such a mess currently after all the conflicting rebases... |
and reuse vertices for outline and fill instead of adding them twice
-> #1606 |
Closes #682. Not ready yet. To do: