(a, b)
| 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 |
| 2127 | function 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) |
| 2149 | function insertNode(i, x, y, last) { |
no outgoing calls
no test coverage detected