I haven't had time to look into this very much but it occurs to me that if
you could express the line in polar coordinates centered at the origin of
the sphere, it might turn into a relatively simple problem.

On Wed, Oct 6, 2010 at 4:53 PM, Henry Rich <[email protected]> wrote:

> Given circle/sphere with center C and radius R, and a line-segment with
> startpoint S and endpoint E, write the J code to tell whether the
> line-segment intersects the circle/sphere.
>
> R is an atom, the rest are lists with 2 or 3 atoms.
>
> This problem arises in collision detection for games and simulators, or
> if you are trying to see whether a path intersects a round obstacle.
>
> I found a solution whose brevity surprised me.
>
> Henry Rich
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to