| 98667 | } |
| 98668 | |
| 98669 | function intersectBoxLine(box, x, y, u, v) { |
| 98670 | const { |
| 98671 | x1, |
| 98672 | y1, |
| 98673 | x2, |
| 98674 | y2 |
| 98675 | } = box, |
| 98676 | dx = u - x, |
| 98677 | dy = v - y; |
| 98678 | let t0 = 0, |
| 98679 | t1 = 1, |
| 98680 | p, |
| 98681 | q, |
| 98682 | r, |
| 98683 | e; |
| 98684 | |
| 98685 | for (e = 0; e < 4; ++e) { |
| 98686 | if (e === 0) { |
| 98687 | p = -dx; |
| 98688 | q = -(x1 - x); |
| 98689 | } |
| 98690 | |
| 98691 | if (e === 1) { |
| 98692 | p = dx; |
| 98693 | q = x2 - x; |
| 98694 | } |
| 98695 | |
| 98696 | if (e === 2) { |
| 98697 | p = -dy; |
| 98698 | q = -(y1 - y); |
| 98699 | } |
| 98700 | |
| 98701 | if (e === 3) { |
| 98702 | p = dy; |
| 98703 | q = y2 - y; |
| 98704 | } |
| 98705 | |
| 98706 | if (Math.abs(p) < 1e-10 && q < 0) return false; |
| 98707 | r = q / p; |
| 98708 | |
| 98709 | if (p < 0) { |
| 98710 | if (r > t1) return false;else if (r > t0) t0 = r; |
| 98711 | } else if (p > 0) { |
| 98712 | if (r < t0) return false;else if (r < t1) t1 = r; |
| 98713 | } |
| 98714 | } |
| 98715 | |
| 98716 | return true; |
| 98717 | } |
| 98718 | },{"./canvas/context":"jnR2","../Bounds":"qFnp"}],"bYPb":[function(require,module,exports) { |
| 98719 | "use strict"; |
| 98720 | |