(start, triangles, dim, minX, minY, size)
| 1829 | |
| 1830 | // try splitting polygon into two and triangulate them independently |
| 1831 | function splitEarcut(start, triangles, dim, minX, minY, size) { |
| 1832 | // look for a valid diagonal that divides the polygon into two |
| 1833 | var a = start; |
| 1834 | do { |
| 1835 | var b = a.next.next; |
| 1836 | while (b !== a.prev) { |
| 1837 | if (a.i !== b.i && isValidDiagonal(a, b)) { |
| 1838 | // split the polygon in two by the diagonal |
| 1839 | var c = splitPolygon(a, b); |
| 1840 | |
| 1841 | // filter colinear points around the cuts |
| 1842 | a = filterPoints(a, a.next); |
| 1843 | c = filterPoints(c, c.next); |
| 1844 | |
| 1845 | // run earcut on each half |
| 1846 | earcutLinked(a, triangles, dim, minX, minY, size); |
| 1847 | earcutLinked(c, triangles, dim, minX, minY, size); |
| 1848 | return; |
| 1849 | } |
| 1850 | b = b.next; |
| 1851 | } |
| 1852 | a = a.next; |
| 1853 | } while (a !== start); |
| 1854 | } |
| 1855 | |
| 1856 | // link every hole into the outer loop, producing a single-ring polygon without holes |
| 1857 | function eliminateHoles(data, holeIndices, outerNode, dim) { |
no test coverage detected