# Extend radius line outward of a sphere and get its coordinates

## Homework Statement

I have a sphere and a line of radius extending from its centre to the outer surface.

I would like to know the coordinates of a point on the tip of the radial line if I were to extend it beyond the surface of the sphere in a straight line.

So I have the length of the radius of the sphere centred @ (0,0,0).

I would like to extend the radius line outward in a straight line by a give amount.

Then I would like to know the coordinates of the tip of the new extended radius line.

## Homework Equations

x^2 + y^2 + z^2 = r^2

## The Attempt at a Solution

(x+a)^2 + (y+b)^2 + (z+c)^2 = (r+d)^2

In the above I know what (r+d)^2 is.

I need to calculate what a, b and c are.

Related Calculus and Beyond Homework Help News on Phys.org
HallsofIvy
Homework Helper
Do you mean you want to increase the radius of the sphere? My first thought, that you wanted "the coordinates of the tip of the new extended radius line" would require that you specify which radius you want to extend. But the form (x+a)^2 + (y+b)^2 + (z+c)^2 = (r+d)^2, another sphere, not the coordinates of a single point, indicates that you are extending every radius to form a new sphere. If that is the case, a= b= c= 0 still while d is the amount you are extending the radius by.

If that is not what you mean, please specify.

Basically I have one sphere only. I have a line extending from the centre to a specific point on the outer shell of the sphere. This is the radius I mean. Now given any one of the radiuses I would like to extend it outward further beyond the sphere by a given amount. Then given all this - I would like to calculate the coords of the end of the new extended radius (going through the sphere).

To be clear - the sphere doesnt change. Only a particular radius-line extends itself outward from inside the sphere.

I think all i need is to create a new larger sphere with the new radius and then get the coordinates from there.

[URL=http://img4.imageshack.us/my.php?image=68660891.jpg][PLAIN]http://img4.imageshack.us/img4/5059/68660891.th.jpg[/URL][/PLAIN]

HallsofIvy
Homework Helper
Then how are you given the line? Are you given angles or are you given the coordinates of the point where it crosses the sphere?

I would use spherical coordinates: For a sphere of radius R, centered at $(x_0, y_0, z_0)$, $x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0$, $y= \rho cos(\theta)sin(\phi)+ y_0$, $z= \rho cos(\phi+ z_0$.

If the line is designated by angles $\theta$ and $\phi$, just replace $\rho$ by R+ d.

If you are told that the line crosses the sphere at $\left(x_1, y_1, z_1\right)$ then you can use $x_1-x_0= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0$, $y_1-y_0= \rho cos(\theta)sin(\phi)+ y_0$, $z_1-z_0= \rho cos(\phi)$ to find $\theta$ and $\phi$.

Dividing the second equation by the first, $(y_1-y_0)/(x_1-x_0)= sin(\theta)/cos(\theta)= tan(\theta)$ so $\theta= tan^{-1}(y_1-y_0)/(x_1-y_0)$. Also $(x_1-x_0)^2+ (y_1-y_0)^2= \rho^2 cos^2(\theta)sin^2(\phi)+ \rho^2 sin^2(\theta)sin^2\phi= \rho^2sin^2\phi$ and $\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}= \rho sin \phi$ while $z_1- z_0= \rho cos\phi$ so $\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1-z_0)= sin\phi/cos\phi= tan\phi$. $\phi= tan^{-1}\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1- z_0)$.
Now use $x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0$, $y= \rho cos(\theta)sin(\phi)+ y_0$, $z= \rho cos(\phi)$ with those values of $\theta$ and $\phi$ and $\rho= R+ d$.

Last edited by a moderator:
Thank you. I will go over the equations and tell you whether Ive understood them. Again - thanks.

BTW - I am given the point of intersection with the sphere and the length of the line both inside and outside the sphere.

HallsofIvy
Homework Helper
Ah, then you are given the $(x_1, y_1, z_1)$ as above. I assume the "length of the line inside" was the radius of the circle. If not then I don't see how it is relevant. The "length of the line outside the sphere" is the d above.

Thanks again Ivy! What are the two angles (theta & phi) and rho?

Hi. Could someone help me with this please? I used this a while back and now forgotten how to.

I am doing this for each point of the sphere without success:

Code:
        Dim p As Double = Radius + Length

Dim phi As Double = Acos((PointOfIntersection.X - Centre.X) / p)

Dim theta As Double = Acos((PointOfIntersection.Y - Centre.Y) / (p * Sin(phi)))

Dim x, y, z As Double

x = p * Cos(theta) * Sin(theta) * Sin(phi) + Centre.X
y = p * Cos(theta) * Sin(phi) +Centre.Y
z = p * Cos(phi)

Return New Point3D(x, y, z)
What am i doing wrong?

nvm - i give up

Last edited: