| 102064 | return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; |
| 102065 | } |
| 102066 | function middleInside(a, b) { |
| 102067 | let p = a; |
| 102068 | let inside = false; |
| 102069 | const px = (a.x + b.x) / 2; |
| 102070 | const py = (a.y + b.y) / 2; |
| 102071 | do { |
| 102072 | if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside; |
| 102073 | p = p.next; |
| 102074 | }while (p !== a); |
| 102075 | return inside; |
| 102076 | } |
| 102077 | function splitPolygon(a, b) { |
| 102078 | const a2 = new Node(a.i, a.x, a.y); |
| 102079 | const b2 = new Node(b.i, b.x, b.y); |