Distance between cone and point How can I find minimum distance between cone and a point ?
Cone properties :
position - $(0,0,z)$
radius - $R$
height -  $h$
Point properties:
position - $(0,0,z_1)$

I assume a right cone.
Put all shapes into a cylindrical coordinate system $(\phi, r, h)$, such that the axis of the cone satisfies $r = 0$. Now, by symmetry of cone, you can throw away $\phi$ and work in two dimensions.
You now have an isosceles triangle with point $A$ at the top and $B$ on the bottom, closer to the given point $X$. Now, the distance is given by
$$\begin{cases}0 & X_h \geq B_h \wedge \vec{X}\cdot \vec{n} < \vec{A} \cdot \vec{n} \\B_h - X_h& X_h < B_h \wedge X_r < B_r  \\AX^2-\Big(\frac{\vec{AX}\cdot\vec{AB}}{AB} \Big)^2 & \vec{AX}\cdot\vec{AB} \geq 0 \wedge \vec{BX}\cdot\vec{BA} \geq 0 \\ \min \{AX, BX\}& otherwise\end{cases}$$
Here $X_h, X_r$ indicate the two coordinates of $X$, $\cdot$ is the inner product and $\vec{n}$ is a normal of $AB$ pointing outwards.
It is surely a mess, but I don't know is anything cleaner can be expected.
