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

Tessellation error with two holes (one touching outer vertex) #45

Closed
voces opened this issue Dec 18, 2015 · 2 comments
Closed

Tessellation error with two holes (one touching outer vertex) #45

voces opened this issue Dec 18, 2015 · 2 comments
Labels

Comments

@voces
Copy link

voces commented Dec 18, 2015

Here's a sample that results in an incorrect tessellation. Appears to be caused when there are two holes where one touches the outer ring and the other does not. Below is an example.

Example image

The first is the actual polygon (gray polygon, white holes), the second is it after running through Earcut, where the dark gray is overlap of triangles. The third is the same as the second except with each triangle having its edges highlighted.

Note it does not actually matter where the hole that is entirely enclosed is. The one that does touch the ring must be touching a vertex.

Vertices: [10,10, 25,10, 25,40, 10,40, 15,30, 20,35, 10,40, 15,15, 15,20, 20,15]
Hole Indicies: [4, 7]
Triangle Indices (result): [9,7,0, 0,7,8, 2,6,5, 4,6,0, 0,1,2, 5,4,0, 0,2,5]

@mourner
Copy link
Member

mourner commented Jan 4, 2016

Thanks for reporting! I'll look into it. I hoped we fixed all cases like this with #39 but apparently not.

@mourner
Copy link
Member

mourner commented Jan 19, 2016

Indentified this as a bug in the hole bridge algorithm. Reproducible with [[[10,10], [25,10], [25,40], [10,40]], [[15,30], [20,35], [10,40]]] (it finds a degenerate bridge along the left edge). Looking into a fix.

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

No branches or pull requests

2 participants