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)

  • 4
    $\begingroup$ Try taking the derivative of the square of the distance function. $\endgroup$ – Qiaochu Yuan Dec 7 '10 at 5:53
  • $\begingroup$ @Qiaochu: Ill give that a try right now. @Timothy: I'll try that as plan "B", heh $\endgroup$ – Faken Dec 7 '10 at 5:58
  • 3
    $\begingroup$ I doubt there will be a closed form solution. Seems like we will have to solve $ A \sin(t+B) + Ct + D = 0$. $\endgroup$ – Aryabhata Dec 7 '10 at 6:02
  • $\begingroup$ 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? $\endgroup$ – Faken Dec 7 '10 at 6:07
  • 1
    $\begingroup$ 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. $\endgroup$ – 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)$.

  • 3
    $\begingroup$ There will be infinitely many points that are local minima and local maxima in distance, but the closest point(s) will have z-coordinate within h*pi of the z-coordinate of the point (a,b,c). $\endgroup$ – Jonas Kibelbek Dec 7 '10 at 12:37
  • 2
    $\begingroup$ @Jonas Kibelbek: There are only a finite number of local minima and maxima. But you are right about the closest point(s). I have edited my response. $\endgroup$ – TonyK Dec 7 '10 at 13:28
  • $\begingroup$ Yes! There are only finitely many. It's clear from the equation and, now that I see it, geometrically as well. $\endgroup$ – Jonas Kibelbek Dec 7 '10 at 14:45
  • $\begingroup$ Hmm, unfortunately this will be part of a computer program, thus i must have a explicit equation otherwise the run times will be too slow (and i also don't want to write an numerical method just to solve this) $\endgroup$ – Faken Dec 7 '10 at 19:06
  • 1
    $\begingroup$ @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. $\endgroup$ – TonyK Dec 27 '10 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.