MCPcopy Create free account
hub / github.com/microsoft/SandDance / middleInside

Function middleInside

docs/app/js/sanddance-app.js:102066–102076  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

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}
102066function 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}
102077function 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);

Callers 1

isValidDiagonalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected