How can I find minimum distance between point and sphere ?
sphere properties :
position of center a,b,c redius of the sphere R
point properties
position x,y,z
How can I find minimum distance between point and sphere ?
sphere properties :
position of center a,b,c redius of the sphere R
point properties
position x,y,z
You essentially just take the distance between the point and the center of the sphere and substract the distance from the center of the sphere to its surface which happens to be the Radius.
$\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R$
where $a,b,c$ are the center of the sphere, $x,y,z$ are the cartesian coordinates of your point and $R$ is the radius of your sphere.
If the point lies within the sphere, by this formula you'd get a negative value. In that case, just do $|\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R|$ In Vectornotation: $|(||\left( \begin{array}{c} a-x \\ b-y \\ c-z \end{array} \right)||_2-R)|$