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

Function intersect

docs/tests/v2/es6/js/sanddance.js:94355–94364  ·  view source on GitHub ↗
(x0, y0, x1, y1, x2, y2, x3, y3)

Source from the content-addressed store, hash-verified

94353}
94354
94355function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
94356 var x10 = x1 - x0,
94357 y10 = y1 - y0,
94358 x32 = x3 - x2,
94359 y32 = y3 - y2,
94360 t = y32 * x10 - x32 * y10;
94361 if (t * t < _math.epsilon) return;
94362 t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
94363 return [x0 + t * x10, y0 + t * y10];
94364} // Compute perpendicular offset line of length rc.
94365// http://mathworld.wolfram.com/Circle-LineIntersection.html
94366
94367

Callers 4

arcFunction · 0.70
sanddance.jsFile · 0.70
hasOverlapFunction · 0.70
clipLineFunction · 0.70

Calls 3

intersectMarkFunction · 0.70
intersectGroupFunction · 0.70
maxMethod · 0.45

Tested by

no test coverage detected