1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Extend radius line outward of a sphere and get its coordinates

  1. Jun 4, 2009 #1
    1. The problem statement, all variables and given/known data

    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.

    2. Relevant equations

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

    3. 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.
  2. jcsd
  3. Jun 4, 2009 #2


    User Avatar
    Science Advisor

    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.
  4. Jun 4, 2009 #3
    Hi. Thanks for the reply.

    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).
  5. Jun 4, 2009 #4
    To be clear - the sphere doesnt change. Only a particular radius-line extends itself outward from inside the sphere.
  6. Jun 4, 2009 #5
    I think all i need is to create a new larger sphere with the new radius and then get the coordinates from there.
  7. Jun 4, 2009 #6
  8. Jun 5, 2009 #7


    User Avatar
    Science Advisor

    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 [itex](x_0, y_0, z_0)[/itex], [itex]x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0[/itex], [itex]y= \rho cos(\theta)sin(\phi)+ y_0[/itex], [itex]z= \rho cos(\phi+ z_0[/itex].

    If the line is designated by angles [itex]\theta[/itex] and [itex]\phi[/itex], just replace [itex]\rho[/itex] by R+ d.

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

    Dividing the second equation by the first, [itex](y_1-y_0)/(x_1-x_0)= sin(\theta)/cos(\theta)= tan(\theta)[/itex] so [itex]\theta= tan^{-1}(y_1-y_0)/(x_1-y_0)[/itex]. Also [itex](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[/itex] and [itex]\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}= \rho sin \phi[/itex] while [itex]z_1- z_0= \rho cos\phi[/itex] so [itex]\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1-z_0)= sin\phi/cos\phi= tan\phi[/itex]. [itex]\phi= tan^{-1}\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1- z_0)[/itex].
    Now use [itex]x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0[/itex], [itex]y= \rho cos(\theta)sin(\phi)+ y_0[/itex], [itex]z= \rho cos(\phi)[/itex] with those values of [itex]\theta[/itex] and [itex]\phi[/itex] and [itex]\rho= R+ d[/itex].
    Last edited by a moderator: Jun 5, 2009
  9. Jun 5, 2009 #8
    Thank you. I will go over the equations and tell you whether Ive understood them. Again - thanks.
  10. Jun 5, 2009 #9
    BTW - I am given the point of intersection with the sphere and the length of the line both inside and outside the sphere.
  11. Jun 5, 2009 #10


    User Avatar
    Science Advisor

    Ah, then you are given the [itex](x_1, y_1, z_1)[/itex] 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.
  12. Jun 5, 2009 #11
    Thanks again Ivy! What are the two angles (theta & phi) and rho?
  13. Mar 21, 2010 #12
    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 (Text):

            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?
  14. Mar 21, 2010 #13
    nvm - i give up
    Last edited: Mar 21, 2010
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook