From f74c9c50b7ea841b0c15757418b719706a4b405b Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 29 Sep 2015 15:40:39 -0700 Subject: [PATCH] Port fix for https://github.com/mapbox/earcut/issues/29 Refs https://github.com/mapbox/earcut.hpp/issues/6 --- include/earcut.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/earcut.hpp b/include/earcut.hpp index 87d4755..4f59792 100644 --- a/include/earcut.hpp +++ b/include/earcut.hpp @@ -668,7 +668,8 @@ Earcut::getLeftmost(Node* start) { // check if a diagonal between two polygon nodes is valid (lies in polygon interior) template bool Earcut::isValidDiagonal(Node* a, Node* b) { - return !intersectsPolygon(a, a, b) && + return a->next->i != b->i && a->prev->i != b->i && + !intersectsPolygon(a, a, b) && locallyInside(a, b) && locallyInside(b, a) && middleInside(a, a->v, b->v); }