4
$\begingroup$

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

  • 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.2012-11-08

4 Answers 4

0

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.

1

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.

  • 0
    @ dexter04: Ok, I'll read the subjects to understand your solution. Just please check your equation if it need edit since according to your postulations I expected e=... and also there is no k in the equation where in next line you say i,j,k...2012-11-08
0

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

See plot here.

  • 0
    Yes. That's the half of sphere.2012-11-08
0

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.