How to tell if a line segment intersects with a circle? Given a line segment, denoted by it's $2$ endpoints $(X_1, Y_1)$ and $(X_2, Y_2)$, and a circle, denoted by it's center point $(X_c, Y_c)$ and a radius $R$, how can I tell if the line segment is a tangent of or runs through this circle? I don't need to be able to discern between tangent or running through a circle, I just need to be able to discern between the line segment making contact with the circle in any way and no contact. If the line segment enters but does not exit the circle (if the circle contains an endpoint), that meets my specs for it making contact.
In short, I need a function to find if any point of a line segment lies in or on a given circle.
EDIT:
My application is that I'm using the circle as a proximity around a point. I'm basically testing if one point is within R distance of any point in the line segment. And it must be a line segment, not a line.

This dude have some nice info about this topic!
Click his name to see more math stuff.
http://local.wasp.uwa.edu.au/~pbourke/geometry/sphereline/
