4

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

jques
  • 73
  • 4
    That would be the distance between the sphere's center and the point, minus the radius? – J. M. ain't a mathematician 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
  • 1
    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! –  Nov 25 '12 at 13:40
  • Oh I didn't even read the comments here. I'm not quite familiar with how stackexchange users are expected to handle questions like this. Why wouldn't you just answer in form of an answer rather than write a comment? – kram1032 Nov 25 '12 at 14:21
  • It's way too short and elementary for an answer, I guess... – DonAntonio Nov 25 '12 at 15:39
  • @DonAntonio I sort of see your point but if a simple question asks for a simple answer, you might as well give that simple answer, right? – kram1032 Nov 25 '12 at 16:02

1 Answers1

5

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

kram1032
  • 1,095
  • 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