Skip to content

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

Closed

Description

@voces

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]

Activity

  1. ghost added on Jan 4, 2016
  2. ghost added on Jan 4, 2016
  3. mourner commented on Jan 4, 2016

    @mourner
    Member

    Thanks for reporting! I'll look into it. I hoped we fixed all cases like this with https://github.com/mapbox/earcut/issues/39 but apparently not.

  4. mourner commented on Jan 19, 2016

    @mourner
    Member

    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.

  5. ghost closed this as completedin 65c7da5on Jan 19, 2016
  6. ghost removed on Jan 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions