Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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

share|improve this question
3  
That would be the distance between the sphere's center and the point, minus the radius? –  J. M. Nov 25 '12 at 13:32
    
Calculate the distance between the point and the sphere's center and substract from here the sphere's radius (can you see why this is so?) –  DonAntonio Nov 25 '12 at 13:32
    
$\left\vert\sqrt{(a-x)^2+(b-y)^2+(c-z)^2}-R\right\vert$ –  Hagen von Eitzen Nov 25 '12 at 13:34
    
Hehe...within 2 minutes, 3 answers that look different yet they convey exactly the same. Ah, I love it when we mathematicians drive nuts non-mathematicians. –  DonAntonio Nov 25 '12 at 13:37
1  
Well, one of you three ought to post a real answer! –  Rahul Nov 25 '12 at 13:40

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
If you already wrote an answer, why won't you add at least a hint on why this works? Something about euclidean geometry, tangent plane to a sphere and stuff? –  DonAntonio Nov 25 '12 at 15:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.