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

Endless loop in the filterPoints function #92

Closed
shlem opened this issue Mar 22, 2021 · 1 comment
Closed

Endless loop in the filterPoints function #92

shlem opened this issue Mar 22, 2021 · 1 comment

Comments

@shlem
Copy link

shlem commented Mar 22, 2021

Hi
You wrote an excellent library. It is very easy to use and fast. I included it to my project to triangulate ESRI geo shape files and everything worked well till I found a problematic file. After a few hours of debugging I found and fixed (hope!) the problem.
With the following integer data (one outer polygon with one hole).

878 412 878 413 878 412 879 412 878 412 879 412 880 412 879 412 880 412 879 412 879 413 880 413 880 412 880 413 879 413 878 413
878 412 878 413 879 413 879 412 878 412 879 412 878 412 879 412 879 413 878 413 878 412 878 413

the filterPoints function goes to endless loop.
It seems to me that it is not good idea to call this function and don't get result, because the first node can be removed and disconnected from the linked list.

I know that this is a very degenerated case, but I got it when render a small polygon in a big zoom

My fix as follows:

  1. Comment two lines in eliminateHole() function
    //!! filterPoints(outerNode, outerNode->next);
    //!! filterPoints(b, b->next);

  2. Add one line in Earcut::operator() function after optional call to eliminateHoles() function
    outerNode = filterPoints( outerNode ); //!! filter the entire polygon

@mrgreywater
Copy link
Collaborator

The issue should be resolved with the current version. Could you please check again?

@mourner mourner closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2022
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

No branches or pull requests

3 participants