# Min. distance from a point to a line in 3d

1. Nov 16, 2016

### mars187

1. The problem statement, all variables and given/known data
There's a person on the ground in (0,0,0). An object comes from the sky and hits the ground at (a,b,0), but continues propagating, that is, it does not stop. I need to find the minimum distance between the person and the object.

All we know is that the person is in (0,0,0), the object hits the surface on (a,b,0) and the object comes with $\theta$ and $\phi$ (see this figure).

2. Relevant equations

I'm using the following to try to solve this:

$$d = \dfrac{|\vec{M_0}\vec{M_1} \times \vec{s}|}{|\vec{s}|}$$

where $M_1$ is a point in the line, $M_0$ is the point (0,0,0) and #\vec{s}# is the directing vector.

3. The attempt at a solution

So, what I did was apply the equation of $d$, with $M_0 = (0,0,0)$, $M_1 = (a,b,0)$ and $\vec{s} = (a+\sin(\theta)*\cos(\phi); b + \sin (\phi) \sin (\theta); \cos (\theta))$. It comes:

$$d = \sqrt{(a^2+b^2)*\cos^2 (\theta) + a^2*\sin^2(\theta)*\sin^2(\phi)+b^2*\sin^2(\theta)*\cos^2(\phi)-2ab*\sin^2(\theta)\cos(\phi)*\sin(\phi)}$$

This is not correct, because for $\phi = pi/2$, d should be $d = (a^2+b^2)\cos (\theta)$..

Where have I gone wrong?

2. Nov 16, 2016

### BvU

Hello mars,

Check what is meant with a direction vector. The line is described by $\vec M_1+\alpha \vec s$ with $\ \alpha \$ a real number; so I think your direction vector should not contain $a$ and $b$.

Last edited: Nov 16, 2016
3. Nov 16, 2016

### mars187

Are you saying that $\vec{s} = (\sin(\theta)*\cos(\phi); \sin(\phi)*\sin(\theta); \cos(\theta))$? I agree, and that's what I used in the denominator (unknowingly).

Instead of using the equation for $d$ that I showed, one could use the one that's in the following link: http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html

In there, the denominator is |\bold{x_2} - \bold{x_1}|, which would be what you're saying. However, the result is still wrong. I've made a mistake somewhere else.

4. Nov 16, 2016

### BvU

You also used it in the numerator !

How do you know it's wrong ? Because it doesn't satisfy the requirement? (if I assume you meant $\ d = \sqrt{a^2+b^2}\; \cos\theta\$ ) you mentioned. Then perhaps we should check if the requirement is correct ?

5. Nov 16, 2016

### LCKurtz

What does it mean when you say a line "comes with" $\theta$ and $\phi$?