MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / cureLocalIntersections

Function cureLocalIntersections

libs/mapv/mapv.js:1806–1828  ·  view source on GitHub ↗
(start, triangles, dim)

Source from the content-addressed store, hash-verified

1804
1805// go through all polygon nodes and cure small local self-intersections
1806function 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
1831function splitEarcut(start, triangles, dim, minX, minY, size) {

Callers 1

earcutLinkedFunction · 0.85

Calls 5

equalsFunction · 0.85
locallyInsideFunction · 0.85
removeNodeFunction · 0.85
pushMethod · 0.80
intersectsFunction · 0.70

Tested by

no test coverage detected