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

Function splitPolygon

libs/mapv/mapv.js:2127–2146  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

2125// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;
2126// if one belongs to the outer ring and another to a hole, it merges it into a single ring
2127function splitPolygon(a, b) {
2128 var a2 = new Node(a.i, a.x, a.y),
2129 b2 = new Node(b.i, b.x, b.y),
2130 an = a.next,
2131 bp = b.prev;
2132
2133 a.next = b;
2134 b.prev = a;
2135
2136 a2.next = an;
2137 an.prev = a2;
2138
2139 b2.next = a2;
2140 a2.prev = b2;
2141
2142 bp.next = b2;
2143 b2.prev = bp;
2144
2145 return b2;
2146}
2147
2148// create a node and optionally link it with previous one (in a circular doubly linked list)
2149function insertNode(i, x, y, last) {

Callers 2

splitEarcutFunction · 0.85
eliminateHoleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected