1
$\begingroup$

enter image description here

I have two lines defined by a point and a vector:

  • $Q(s) = A + s\vec{v}$
  • $P(t) = B + t\vec{u}$

Suppose distance d is given

I want to know $s$ and $t$ for points $P$ and $Q$ in terms of $d$. $d$ is perpendicular to $line(B, \vec{u})$

so I found out (wikipedia):

$ \begin{aligned} d & = ||(B - Q) - ((B - Q).\vec{u})\vec{u}|| \\ & = ||(B - A - s\vec{v}) - ((B - A - s\vec{v})\cdot\vec{u})\vec{u}|| \\ & = ||(\vec{w} - s\vec{v}) - ((\vec{w} - s\vec{v})\cdot\vec{u})\vec{u} || \end{aligned} $

Can somebody explain the algebra to write $s$ in terms of $d$

$s = f(d) = \dots$

  • 0
    How would you solve it then? I want to apply it to the following situation: point $A$ is a ball with radius $d$ travelling a distance $\vec{v}$. It may hit a wall $(B, \vec{u})$. I want to calculate whether and where in its trajectory it hits the wall as well as the point of collision on the wall.2012-11-20

1 Answers 1

1

The problem can be solved in another way. Let $F$ be the foot of perpendicular drawn from $A$ to the line $BP$. Then $ \vec{AF} = \vec{w} - \frac{\vec{w}\cdot\vec{u}}{\|\vec{u}\|^2}\vec{u}. $ Let $R=A+\lambda\vec{v}$ be the point where the line extending $QA$ meets the line extending $PB$. Then $\vec{AF} \perp \vec{RF} (=\vec{RA}+\vec{AF})$. Hence $\vec{AF}\cdot(-\lambda\vec{v}+\vec{AF})=0.$ Solve it to get $\lambda$. Then, by similarity of triangles, we have $ \frac{d}{\|\vec{AF}\|} = \frac{\|\vec{RQ}\|}{\|\vec{RA}\|} \equiv \frac{\lambda-s}{\lambda},\\ $ So you may solve for $s$. Finally, $t$ can be solved by observing that: $ t\vec{u} = \vec{BP} = \textrm{ projection of } \vec{BQ} \textrm{ along } \vec{u} =\left[(s\vec{v}-\vec{w})\cdot\frac{\vec{u}}{\|\vec{u}\|}\right]\frac{\vec{u}}{\|\vec{u}\|}. $