Skip to content
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

use mapbox/earcut library for efficient earclipping #581

Merged
merged 7 commits into from
Nov 25, 2015

Conversation

andreasplesch
Copy link
Contributor

This PR replaces the earclipping algorithm with a more efficient earclipping library available here:
https://github.com/mapbox/earcut
The main advantage is handling of corner cases and large polygons.
The dedicated library is compact and included directly in EarClipping.js but it could be moved to a separate file.
There is some required remapping of input and output to and from the library which could be optimized by directly using the provided x3dom linkedlist.
The library also deals with holes in polygons if needed elsewhere (fonts?) at some point.
This user script allows for testing:
https://gist.githubusercontent.com/andreasplesch/42d6405d0de8cc2472b8/raw/x3domEarcut.user.js

@ajcyeh
Copy link

ajcyeh commented Nov 23, 2015

mlimper pushed a commit that referenced this pull request Nov 25, 2015
use mapbox/earcut library for efficient earclipping
@mlimper mlimper merged commit 092ce52 into x3dom:master Nov 25, 2015
@mlimper
Copy link
Contributor

mlimper commented Nov 25, 2015

Thanks!

@andreasplesch
Copy link
Contributor Author

Ok. I will let Vladimir, the author of earcut, know as well.

mapbox/earcut#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants