8
$\begingroup$

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
    Try taking the derivative of the square of the distance function.2010-12-07
  • 0
    @Qiaochu: Ill give that a try right now. @Timothy: I'll try that as plan "B", heh2010-12-07
  • 3
    I doubt there will be a closed form solution. Seems like we will have to solve $ A \sin(t+B) + Ct + D = 0$.2010-12-07
  • 0
    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?2010-12-07
  • 1
    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.2010-12-07
  • 0
    You may want to tag this as differential geometry2010-12-07

1 Answers 1

9

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
    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).2010-12-07
  • 2
    @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.2010-12-07
  • 0
    Yes! There are only finitely many. It's clear from the equation and, now that I see it, geometrically as well.2010-12-07
  • 0
    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)2010-12-07
  • 1
    @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.2010-12-27
  • 0
    @Tony: no actually...if I knew it was imposable I wouldent have asked it... Well since this was a sort of a comp sci related question, I'll solve using other less ridged methods.2010-12-30
  • 0
    @Faken: Good luck with that...2011-01-03
  • 0
    I believe this is indeed possible... first transform the helix and the point so that the z component of the point is 0, divide the point by its distance from the origin (now it is a unit direction vector), use arctangent to get the angle of the direction, plug back into the helix formula as t to find the closest point. Then simply find the distance between that new point and the original point. Pardon my mathspeak, I am a programmer.2017-01-20
  • 0
    @Rodolvertice: That will not give you the closest point, in general. To see this, imagine the helix is very long and thin.2017-01-20
  • 0
    I guess you could account for that possibility too by also checking distance from the point to the point on the helix with the same z coordinate, and then just choose the smallest distance value, but I see your point in that it is not general because between those two special cases there are many cases which are not accounted for. But, making some assumptions about the given helix, it can still be useful for many applications.2017-01-21