MCPcopy
hub / github.com/dhotson/springy / intersect_line_box

Function intersect_line_box

springyui.js:376–389  ·  view source on GitHub ↗
(p1, p2, p3, w, h)

Source from the content-addressed store, hash-verified

374 }
375
376 function intersect_line_box(p1, p2, p3, w, h) {
377 var tl = {x: p3.x, y: p3.y};
378 var tr = {x: p3.x + w, y: p3.y};
379 var bl = {x: p3.x, y: p3.y + h};
380 var br = {x: p3.x + w, y: p3.y + h};
381
382 var result;
383 if (result = intersect_line_line(p1, p2, tl, tr)) { return result; } // top
384 if (result = intersect_line_line(p1, p2, tr, br)) { return result; } // right
385 if (result = intersect_line_line(p1, p2, br, bl)) { return result; } // bottom
386 if (result = intersect_line_line(p1, p2, bl, tl)) { return result; } // left
387
388 return false;
389 }
390
391 return this;
392}

Callers 1

springyui.jsFile · 0.85

Calls 1

intersect_line_lineFunction · 0.85

Tested by

no test coverage detected