Intersection between a line and a sphere

前端 未结 8 2207
无人及你
无人及你 2021-02-09 05:51

I\'m trying to find the point of intersection between a sphere and a line but honestly, I don\'t have any idea of how to do so. Could anyone help me on this one ?

8条回答
  •  花落未央
    2021-02-09 06:40

    You may use Wolfram Alpha to solve it in the coordinate system where the sphere is centered.

    In this system, the equations are:

    Sphere:

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

    Straight line:

        x = x0 + Cos[x1] t
        y = y0 + Cos[y1] t
        z = z0 + Cos[z1] t 
    

    Then we ask Wolfram Alpha to solve for t: (Try it!)

    and after that you may change again to your original coordinate system (a simple translation)

提交回复
热议问题