Skip to content

Commit

Permalink
fix #17 (another edge case)
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Mar 18, 2015
1 parent e457796 commit d708db9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -90,6 +90,10 @@ npm test

#### Changelog

##### 1.4.2 (Mar 18, 2015)

- Fixed another rare edge case with a tiny hole in a huge polygon.

##### 1.4.1 (Mar 17, 2015)

- Fixed a rare edge case that led to incomplete triangulation.
Expand Down
2 changes: 1 addition & 1 deletion src/earcut.js
Expand Up @@ -327,7 +327,7 @@ function splitEarcut(start, triangles, minX, minY, size) {
do {
var b = a.next.next;
while (b !== a.prev) {
if (isValidDiagonal(a, b)) {
if (a.p !== b.p && isValidDiagonal(a, b)) {
// split the polygon in two by the diagonal
var c = splitPolygon(a, b);

Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/issue17.json
@@ -0,0 +1,13 @@
[
[[-20037508.34,19971868.877628453,0],
[-20037508.34,-19971868.877628453,0],
[20037508.34,-19971868.877628453,0],
[20037508.34,19971868.877628453,0]],
[[537637.6007702783,5907542.234420554,0],
[539500.1483225027,5905165.501947839,0],
[538610.3146341922,5905217.430281373,0],
[538040.6306361248,5906132.0755739985,0],
[538068.958329954,5906571.138846622,0],
[537711.0379352621,5906645.06648362,0],
[537629.886026485,5907533.69114742,0]]
]
1 change: 1 addition & 0 deletions test/test.js
Expand Up @@ -19,6 +19,7 @@ areaTest('degenerate');
areaTest('bad-hole', 0.0420);
areaTest('empty-square');
areaTest('issue16');
areaTest('issue17');

indicesCreationTest('indices-2d');
indicesCreationTest('indices-3d');
Expand Down

0 comments on commit d708db9

Please sign in to comment.