Skip to content

Conversation

@finscn
Copy link

@finscn finscn commented Dec 9, 2017

Only water-huge2 failed .
the log says :

not ok 18 4464 triangles when expected 4461

I think maybe something is wrong in the test-case.

Only `water-huge2` failed .
the log says : 
```
not ok 18 4464 triangles when expected 4461
```

I think maybe  something is wrong in the test-case.
@finscn
Copy link
Author

finscn commented Dec 9, 2017

With this PR , it could solve the problem in #74 :

image

@mourner
Copy link
Member

mourner commented Dec 10, 2017

Cool! Can you describe the logic in more detail here?

@finscn
Copy link
Author

finscn commented Dec 10, 2017

the key code is :

        var toRemove = false;

        if (!p.steiner) {
            if (equals(p, p.next) || equals(p.prev, p)) {
                toRemove = true;
            } else if (area(p.prev, p, p.next) === 0) {
                // If `p.prev, p & p.next` are on holes (not outer edge) ,
                // And `p.prev & p` are on the same hole ,
                // Then do NOT remove `p` .
                if (prevHole && nextHole && prevHole !== nextHole && prevHole === currentHole) {
                    toRemove = false;
                } else {
                    toRemove = true;
                }
            }
        }

But there is something I can't understand about

            if (equals(p, p.next) || equals(p.prev, p)) {
                toRemove = true;

if no || equals(p.prev, p) , the test-case in #74 will be failed.

@finscn
Copy link
Author

finscn commented May 6, 2018

Is there any news about this pr & issue ?

@finscn
Copy link
Author

finscn commented Jun 7, 2018

Is there any news about this pr & issue ???

@mourner
Copy link
Member

mourner commented Jun 9, 2018

@finscn sorry, I didn't have the chance to thoroughly review it yet. It's on my list. Feel free to use your forked version in the mean time.

@stefnotch
Copy link

I don't mean to add useless noise, but I'd be interested if there is a chance of this PR getting merged anytime soon.

JaffaKetchup added a commit to JaffaKetchup/dart_earcut that referenced this pull request Jan 31, 2024
Updated LICENSE to be in-line with Mapbox's ISC requirements
@gkjohnson
Copy link

gkjohnson commented May 12, 2025

Hello! Just wanted to check in on this PR to see if it needs a nudge. I'm unfortunately not an expert in any of the earcut logic in this project but I am using it for polygon triangulation in a few projects can the issue of unmatched edges in the result has been causing some issue for me.

Thanks for making the project available!

edit

I think maybe something is wrong in the test-case.

There's probably more to these test cases than I'm aware but at first glance the water-huge2 test case doesn't look like a valid input polygon? Specifically the volume-less corner lines here:

image

And what looks like invalid triangulation here in master:

image

The "water" example similarly has an invalid triangulation here in master:

image

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.

4 participants