Skip to content

Commit

Permalink
fix another edge case with touching holes (#125)
Browse files Browse the repository at this point in the history
closes #56
  • Loading branch information
mourner committed Sep 19, 2019
1 parent 4768bd9 commit 62d3834
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/earcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,7 @@ function findHoleBridge(hole, outerNode) {

// whether sector in vertex m contains sector in vertex p in the same coordinates
function sectorContainsSector(m, p) {
return (
(area(m.prev, m, p.prev) < 0 || area(p.prev, m, m.next) < 0) &&
(area(m.prev, m, p.next) < 0 || area(p.next, m, m.next) < 0)
);
return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;
}

// interlink polygon nodes in z-order
Expand Down
1 change: 1 addition & 0 deletions test/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"hourglass": 2,
"touching2": 8,
"touching3": 15,
"touching4": 20,
"rain": 2681
},
"errors": {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/touching4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[[11,10],[0,10],[0,0],[11,0]],[[7,6],[7,9],[10,9]],[[7,5],[10,2],[10,5]],[[6,9],[1,4],[1,9]],[[1,1],[1,4],[4,1]]]
4 changes: 4 additions & 0 deletions viz/viz.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 62d3834

Please sign in to comment.