# Shortest distance between a point and a helix

I have a helix in parametric equations that wraps around the Z axis and a point in space. I want to determine the shortest distance between this helix and the point, how would i go about doing that?

I've tried using Pythagorean theorem to get the distance and then taking the derivative of the distance function to find the zeros but I can't seem to get an explicit equation for T and I'm stuck at that.

(I apologize for the tags, not sure how to tag it and I cant create new ones either)

• Try taking the derivative of the square of the distance function. – Qiaochu Yuan Dec 7 '10 at 5:53
• @Qiaochu: Ill give that a try right now. @Timothy: I'll try that as plan "B", heh – Faken Dec 7 '10 at 5:58
• I doubt there will be a closed form solution. Seems like we will have to solve $A \sin(t+B) + Ct + D = 0$. – Aryabhata Dec 7 '10 at 6:02
• I can't do it, can't get the equation in explicit form. How would i go about trying this in cylindrical coordinates? Got any links for me to read up on about attempting something like this? – Faken Dec 7 '10 at 6:07
• I don't think cylindrical coordinates will help; the formula for distance will just get messier. If the point has nice coordinates and the helix has nice parametrization, and no "obvious" solution like t=3pi/2 works, then I would guess the answer is too messy to write down. In that case, I would ask a computer to find the minimum distance. – Jonas Kibelbek Dec 7 '10 at 8:58

Let the helix be given by $(\cos t, \sin t, ht)$ (after scaling). If $P$ is your point $(a,b,c)$, and $Q = (\cos t, \sin t, ht)$ is the nearest point on the helix, then $PQ$ is perpendicular to the tangent at $Q$, which is just $(-\sin t, \cos t, h)$:
$-(\cos t - a)\sin t + (\sin t - b)\cos t + (ht - c)h = 0$
This simplifies to $A \sin(t+B) + Ct + D = 0$ for some constants $A,B,C,D,$ as Moron said. But then you have to solve this numerically. There will be more than one solution in general, but (as Jonas Kibelbek pointed out in the comments) you only need to check the solutions with $z$-coordinate in the interval $[c-\pi h, c+\pi h)$.
• @Faken: Do you realise that you're asking the impossible? If you had an explicit equation to solve this problem, then you would have an explicit equation to solve $A\sin(t+B)+Ct+D=0$ for any values of $A,B,C,D$. Which is impossible. So you'll have to settle for what we've given you, I'm afraid. – TonyK Dec 27 '10 at 23:22