-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Earcut.js #3998
Conversation
All looks good so far! |
//>>includeStart('debug', pragmas.debug); | ||
if (!defined(positions)) { | ||
throw new DeveloperError('positions is required.'); | ||
} | ||
if (positions.length < 3) { | ||
throw new DeveloperError('At least three positions are required.'); | ||
if (!defined(holes)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this required, it doesn't look like earcut
requires it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, thanks.
@pjcozzi This is ready for another look. |
Do you have a representative total performance improvement for a large dataset? |
@pjcozzi Triangulation when loading all of the country borders takes 305.322ms on average for the whole dataset in the branch and 641.598ms in master. |
Sounds great. Can you add this example performance improvement to CHANGES.md? Is anything else needed before we can merge this? |
FYI, I ran this on the full NYC set I was working with last week and it fixed tons of problems that we were having with the old triangulation code. So this is a big 👍 from me. |
CHANGES.md was updated. I think this is good to go. |
@bagnell given that this will be of interest to many users, can you please email the forum to let them know this is coming in Cesium 1.23 on July 1? |
@@ -5,6 +5,9 @@ Change Log | |||
|
|||
* Add a `rotatable2D` option to to `Scene`, `CesiumWidget` and `Viewer` to enable a rotatable map in 2D. [#3897](https://github.com/AnalyticalGraphicsInc/cesium/issues/3897) | |||
* `Camera.setView` and `Camera.flyTo` will now use the `orientation.heading` parameter in 2D if the map is rotatable. | |||
* Added `packArray` and `unpackArray` functions to `Cartesian2`, `Cartesian3`, and `Cartesian4`. | |||
* Fix some large polygon triangulations. [#2788](https://github.com/AnalyticalGraphicsInc/cesium/issues/2788) | |||
* Improved performance and accuracy of polygon triangulation by using the [earcut](https://github.com/mapbox/earcut) library. Loading a GeoJSON with polygons for each country was ~50% faster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean 2x faster, i.e., 50% less time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I'll fix it in master.
Awesome work, happy to see it used in Cesium! |
Uses earcut.js for triangulation. Fixes #2788. Fixes some of the files uploaded to #3044, but the ones that still don't work look better. The files in #1209 work. The problem with the US states happens because of the intersecting edges.
TODO:
eliminateHoles
codetriangulate
code