Sphere Line

Blitz3D Forums/Blitz3D Programming/Sphere Line

Nack(Posted 2008) [#1]
I am too tired and probaly rusty with my math skills, anyone willing to help me out?

http://local.wasp.uwa.edu.au/~pbourke//geometry/sphereline/

I used this as a bases to calculate intersection between line and sphere. I got it to work...however, the ray is infinite. I can t seem to make it a certain length only. The line is infinte length. And i cant figure it out for the life of me.


Jasu(Posted 2008) [#2]
You didn't mention did you want 2D or 3D.
Here's the 2D version:
http://www.blitzbasic.com/codearcs/codearcs.php?code=2180
See function DistanceToLineSegment
It should be easy to convert it to 3D if you need to.