Results 1 to 6 of 6

Math Help - Sphere-line intersection

  1. #1
    Member
    Joined
    May 2008
    Posts
    87

    Sphere-line intersection

    I want to find the coordinates of where a line projected from inside a sphere intersects the inner surface of the sphere.

    The sphere is: 4(x-2)^2 + 16(y-4)^2 + (z-5)^2 = 400
    Eye point at: (13, -3.5, 29)^T
    Viewing direction: (-2, 3, -16)^T

    At what coordinates does the line from the eye point in direction of the viewing direction hit the surface of the sphere?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    16,224
    Thanks
    1791
    Quote Originally Posted by posix_memalign View Post
    I want to find the coordinates of where a line projected from inside a sphere intersects the inner surface of the sphere.

    The sphere is: 4(x-2)^2 + 16(y-4)^2 + (z-5)^2 = 400
    Eye point at: (13, -3.5, 29)^T
    Viewing direction: (-2, 3, -16)^T

    At what coordinates does the line from the eye point in direction of the viewing direction hit the surface of the sphere?
    A line, in three dimensions, that includes the point (x_0, y_0, z_0) and points in the direction of vector <A, B, C> can be written in parametric equations as x= At+ x_0, y= Bt+ y_0, and z= Ct+ z_0. The line from the eye point, (13, -3.5, 29) in direction <-2, -3, -16> has equations x= -2t+ 13, y= -3t- 3.5, and z= -16t+ 29.

    Replace x, y, and z in the equation of the sphere with those and you get one quadratic equation for t. Solve for t, then use the parametric equations of the line to find the corresponding x, y, and z values.

    A quadratic equation may have no real solution, one (double) solution, or two solutions. Those correspond to the cases where the line misses the sphere entirely, is tangent to the sphere, or crosses through the sphere.

    Since the given point is inside the sphere, there will have to be two solutions, one with t negative and one with t positive. Since the parametric equations were set up with t multiplying the direction vector, the correct solution will be the one for the positive t.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    May 2008
    Posts
    87
    Quote Originally Posted by HallsofIvy View Post
    A line, in three dimensions, that includes the point (x_0, y_0, z_0) and points in the direction of vector <A, B, C> can be written in parametric equations as x= At+ x_0, y= Bt+ y_0, and z= Ct+ z_0. The line from the eye point, (13, -3.5, 29) in direction <-2, -3, -16> has equations x= -2t+ 13, y= -3t- 3.5, and z= -16t+ 29.

    Replace x, y, and z in the equation of the sphere with those and you get one quadratic equation for t. Solve for t, then use the parametric equations of the line to find the corresponding x, y, and z values.

    A quadratic equation may have no real solution, one (double) solution, or two solutions. Those correspond to the cases where the line misses the sphere entirely, is tangent to the sphere, or crosses through the sphere.

    Since the given point is inside the sphere, there will have to be two solutions, one with t negative and one with t positive. Since the parametric equations were set up with t multiplying the direction vector, the correct solution will be the one for the positive t.
    Thanks!

    I just tried your suggested solution but I got that t = 2.5 or t = 1.5 -- no negative t, I double checked my calculations, perhaps I still made some miscalculation or is it possible to get two positive t?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor

    Joined
    Apr 2005
    Posts
    16,224
    Thanks
    1791
    Well, you said "a line projected from inside a sphere" so I assumed that you meant that the eye point was inside. It's easy to see that it isn't: 4(13- 2)^2 alone is larger than 400.

    And, by the way, that is not a sphere- it is an ellipsoid.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Member
    Joined
    May 2008
    Posts
    87
    Quote Originally Posted by HallsofIvy View Post
    Well, you said "a line projected from inside a sphere" so I assumed that you meant that the eye point was inside. It's easy to see that it isn't: 4(13- 2)^2 alone is larger than 400.

    And, by the way, that is not a sphere- it is an ellipsoid.
    Ah, I see, sorry for my mistake.

    However does t = 1.5 and t = 2.5 mean that the line intersects the ellipsoid first once on the surface, and then once again from the inside and out (after having passed through the inside of the ellipsoid)?
    Follow Math Help Forum on Facebook and Google+

  6. #6
    MHF Contributor

    Joined
    Apr 2005
    Posts
    16,224
    Thanks
    1791
    Well, if then the line is projected from inside the sphere to the eyepoint, the point at which it strikes the surface is the point closer to the eyepoint.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Line, sphere intersection.
    Posted in the Geometry Forum
    Replies: 1
    Last Post: April 30th 2011, 08:22 PM
  2. Intersection of Plane and Sphere
    Posted in the Geometry Forum
    Replies: 1
    Last Post: December 19th 2010, 12:57 PM
  3. Intersection of two sphere
    Posted in the Calculus Forum
    Replies: 1
    Last Post: November 5th 2010, 02:29 AM
  4. Intersection of plane with sphere
    Posted in the Geometry Forum
    Replies: 8
    Last Post: October 12th 2010, 09:46 AM
  5. Points of Intersection with sphere
    Posted in the Calculus Forum
    Replies: 1
    Last Post: September 6th 2009, 10:32 AM

Search Tags


/mathhelpforum @mathhelpforum