[Math] Shortest distance between a point and a helix

geometry

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)

Best Answer

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)$.