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

Function intersects

libs/mapv/mapv.js:2090–2093  ·  view source on GitHub ↗
(p1, q1, p2, q2)

Source from the content-addressed store, hash-verified

2088
2089// check if two segments intersect
2090function intersects(p1, q1, p2, q2) {
2091 if (equals(p1, q1) && equals(p2, q2) || equals(p1, q2) && equals(p2, q1)) return true;
2092 return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;
2093}
2094
2095// check if a polygon diagonal intersects any polygon segments
2096function intersectsPolygon(a, b) {

Callers 2

cureLocalIntersectionsFunction · 0.70
intersectsPolygonFunction · 0.70

Calls 2

equalsFunction · 0.85
areaFunction · 0.85

Tested by

no test coverage detected