code: function splitPolygon(a, b) {
         var a2 = new Node(a.i, a.x, a.y),
             b2 = new Node(b.i, b.x, b.y),
             an = a.next,
             bp = b.prev;
  
         a.next = b;
         b.prev = a;
  
         a2.next = an;
         an.prev = a2;
  
         b2.next = a2;
         a2.prev = b2;
  
         bp.next = b2;
         b2.prev = bp;
  
         return b2;
     }
docs: link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; if one belongs to the outer ring and another to a hole, it merges it into a single ring