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.

I have a point m outside a sphere. The sphere center is o and r is the radius of sphere. Distance from point m to o is l. If we draw a line from m to any point on the surface of sphere, this line has a length. Minimum length is l - r and maximum length would be l + r. I want the equation for distance from m to any point on the surface of sphere.

Also how to draw the graph of this equation (all possible distances)?

enter image description here

share|improve this question
3  
How do you want to specify a point on the surface? If the point on the surface is $s$, then the distance is just $\|m-s\|$. –  copper.hat Nov 8 '12 at 20:00
1  
The thing is, when you say "all possible distances", it looks like you're asking not for a function, but simply for the set of all possible distances. In this case the set is simply the segment $[1-r, 1+r]$, since distance is a contiouous function and the sphere is connected )) If you do want a function and not a set, then it's not clear what you want to be the argument of that function. –  Dan Shved Nov 8 '12 at 20:31
    
@Dan Shved: You right. I need a partial equation which gives l and r and the output is in the range of possible distances. –  Xaqron Nov 8 '12 at 20:56
2  
The problem is insufficiently described, perhaps because insufficiently understood. A “function” would have for its input a point on the sphere, and for its output the distance to $m$. But how is the point on the sphere to be described. @DanShved has described the difficulty in a nutshell. –  Lubin Nov 8 '12 at 21:44

4 Answers 4

The center of the circle is at o and its radius is $r$. So, any general point on the surface of the sphere is given by $\mathbf{p} = \mathbf{o} +r \mathbf{\hat{e}}$, where $\mathbf{\hat{e}}$ is the radial unit vector in spherical co-ordinates.

In Cartesian coordinates, $$\mathbf{\hat{r}} =\sin{\theta}\cos{\phi} \mathbf{\hat{i}} + \sin{\theta}\sin{\phi}\mathbf{\hat{j}} + \cos{\theta} \mathbf{\hat{j}}$$ where $\mathbf{\hat{i}},\mathbf{\hat{j}},\mathbf{\hat{k}}$ are unit vectors along X,Y,Z directions respectively.

So, what you are looking for is $dist(\mathbf{m,p})$ If you already know the point $\mathbf{p}$, just find out this distance.

In order to plot this function , just vary $\theta$ from $0$ to $180$ degrees and $\phi$ from $0$ to $360$ degrees to cover the whole circle and find out $dist(\mathbf{m,p})$ for all the points. Store the values in an array and plot them.

Let me know if you need code in MATLAB or some other language.

share|improve this answer
    
I don't have a specific point or the exact distance. Just want the function which covers all the possible distances. This function takes l and r and the output would be an equation based on l and r which produces all possible distances from any point on sphere to o. –  Xaqron Nov 8 '12 at 20:24
    
that is exactly what I have told. From l and r, u can find out m. Given m and r, just change the values of $\theta,\phi$ to produce all possible distances –  dexter04 Nov 8 '12 at 20:27
    
@dextero4: Sorry, I'm not mathematician. I expected a Partial differential equation based on l and r which covers all distances from o to any point on surface of sphere. This equation is not based on l and r, how can I achieve that from your given equation. Thanks in advance. –  Xaqron Nov 8 '12 at 20:38
    
Consider the sphere center is at the origin of coordinate system (0,0,0) so: x2+y2+z2=r2 and m has distance l on z axis from sphere center, outside of sphere (l > r). Now what's the differential equation? –  Xaqron Nov 8 '12 at 20:44
    
There won't be a partial diff equation as there is nothing to differentiate. My equation is based on l and r. m = o+l. And r is used to find p. Then vary $\theta,\phi$ over all the circle to find out all possible values. In case you need some basics, look up polar and azimuthal angles of a circle. BTW, I am also not a mathematician. :) –  dexter04 Nov 8 '12 at 20:54

The real problem is how to describe the position of the point on the surface of the sphere, and @Xaqron has not said how he wants to do that. But consider the plane containing the three points $M$, $O$ (the center of the sphere), and the point $B$ on the surface. You see that it intersects the whole picture in a circle of radius $r$ centered at $O$, and containing $B$. Now consider the angle $\theta=\angle\,MOB$. The honorable Law of Cosines gives us the distance $d=\overline{MB}$ directly: $d^2=1+r^2-2r\cos\theta\,$. But until @Xaqron tells us how he will describe the point on the sphere, we really can’t go any further than this.

share|improve this answer
up vote 0 down vote accepted

This is what I was looking for: distance = enter image description here

See plot here.

share|improve this answer
    
Actually, this is a bit incomplete. If your sphere is $x^2+y^2+z^2=r^2$, then for given $x$ and $y$ there can be up to two points on the sphere with such coordinates: $A=(x, y, \sqrt{r^2-x^2-y^2})$ and $B=(x, y, -\sqrt{r^2-x^2-y^2})$. The formula that you gave is for $A$. The formula for $B$ will be $\sqrt{x^2+y^2+(l+\sqrt{r^2-x^2-y^2})^2}$. –  Dan Shved Nov 8 '12 at 21:58
    
PS: assuming that $M=(0, 0, l)$, of course. –  Dan Shved Nov 8 '12 at 21:59
    
Yes. That's the half of sphere. –  Xaqron Nov 8 '12 at 22:17

Can I Please have the Matlab code for your solution The center of the circle is at o and its radius is r. So, any general point on the surface of the sphere is given by p=o+re^, where e^ is the radial unit vector in spherical co-ordinates.

In Cartesian coordinates, r^=sinθcosϕi^+sinθsinϕj^+cosθj^ where i^,j^,k^ are unit vectors along X,Y,Z directions respectively.

So, what you are looking for is dist(m,p) If you already know the point p, just find out this distance.

In order to plot this function , just vary θ from 0 to 180 degrees and ϕ from 0 to 360 degrees to cover the whole circle and find out dist(m,p) for all the points. Store the values in an array and plot them.

share|improve this answer

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.