(start, triangles, dim)
| 1804 | |
| 1805 | // go through all polygon nodes and cure small local self-intersections |
| 1806 | function cureLocalIntersections(start, triangles, dim) { |
| 1807 | var p = start; |
| 1808 | do { |
| 1809 | var a = p.prev, |
| 1810 | b = p.next.next; |
| 1811 | |
| 1812 | if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { |
| 1813 | |
| 1814 | triangles.push(a.i / dim); |
| 1815 | triangles.push(p.i / dim); |
| 1816 | triangles.push(b.i / dim); |
| 1817 | |
| 1818 | // remove two nodes involved |
| 1819 | removeNode(p); |
| 1820 | removeNode(p.next); |
| 1821 | |
| 1822 | p = start = b; |
| 1823 | } |
| 1824 | p = p.next; |
| 1825 | } while (p !== start); |
| 1826 | |
| 1827 | return p; |
| 1828 | } |
| 1829 | |
| 1830 | // try splitting polygon into two and triangulate them independently |
| 1831 | function splitEarcut(start, triangles, dim, minX, minY, size) { |
no test coverage detected