Note that there are some explanatory texts on larger screens.

plurals
  1. POPoint and line segment intersection point. Both moving
    primarykey
    data
    text
    <p>How would I tell the time and point of intersection between a moving Point at a fixed velocity and a Line Segment whose end-points are moving? The endpoints move independently, but only in the positive y direction, and also at fixed velocities.</p> <p>Picture of situation:</p> <p><img src="https://i.stack.imgur.com/Arg3W.png" alt="intersection.png"></p> <p>So over time t, L1 moves to L2, R1 moves to R2 and P1 moves to P2. At some point the position of P at time t should lie somewhere on the line segment formed by L and R at time t.</p> <p>I stuck every relationship I could come up with in mathematica and had it solve for t, which got me an answer, but it doesn't seem to work when I try and implement it (no collision is ever detected. I'm pretty new to mathematica and don't really know what I'm doing so I'm kind of hoping someone with more experience will notice something fundamentally wrong with how I'm trying to solve the system of equations. Thanks for reading!</p> <p>Where U is the line segment at time t.</p> <ul> <li>Ly = L1y + (L2y - L1y) * t</li> <li>Ry = R1y + (R2y - R1y) * t</li> <li>Py = P1y + (P2y - P1y) * t</li> <li>Px = P1x + (P2x - P1x) * t</li> <li>Ux = L1x + (R1x - L1x) * m</li> <li>Uy = Ly + (Ry - Ly) * m</li> <li>m = (Px - L1x) / (R1x - L1x)</li> </ul> <p>Solving for t where:</p> <ul> <li>Ux = Px</li> <li>Uy = Py</li> </ul> <p>Solution:</p> <ul> <li>A = (P2x - P1x) * (L2y - L1y) - (P2x - P1x) * (R2y - R1y)</li> <li>B = (P2x - P1x) * L1y + (P2x - P1x) * R1y - P1x * (L2y - L1y) + L1x * (L2y - L1y) + P1x * (R2y - R1y) - L1x * (R2y - R1y) + (P2y - P1y) * (R1x - L1x) - (R1x - L1x) * (L2y - L1y)</li> <li>C = P1x * L1y - P1x * R1y - L1y * L1x + R1y * L1x + P1y * (R1x - L1x) - L1y * (R1x - L1x)</li> </ul> <p>t = (-B + -sqrt(B^2 - 4AC)) / 2A</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload