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)
 A: 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)$.
A: The following function gives the signed shortest distance between a point $(a, b, c)$ in space and a helix that coils around the Y-axis and is centered on the origin.
It is not my own result, but rather an answer I found in the comments section of a shader from Shadertoy, namely https://www.shadertoy.com/view/tlXSWM.
$$
sdist = \sqrt{(\sqrt {a^2 + c^2} - r_1)^2 + (\mod\{{\arctan{(\frac{c}{a})} - b, 2 \pi}\} - \pi})^2 - r_2
$$
Where $r_1$ is the radius of the helix itself, and $r_2$ is the radius of the circle inscribing the helix shape. The function was originally given in GLSL as (paraphrased):

float sdf(vec3 q)
{   
    float l = length(q.xz) - r1;
    float d = mod(atan(q.z,q.x)-q.y, 6.28) - 3.14;
    return length(vec2(l, d)) - r2;
}

where $q$ is the point in Euclidean space.
