Circle and Line segment intersection I have a line segment (begin $(x_1,y_1)$, end $(x_2,y_2)$, with $D=5$, let’s say) and a circle (radius $R$, center $(x_3,y_3)$)
How can I check that if my line segment intersects my circle?
picture 
http://kepfeltoltes.hu/120129/inter_www.kepfeltoltes.hu_.png

You can do this analytically:


*

*write the equation of circle : $(x- x_R)^2 + (y - y_R)^2 = R^2$

*write the equation of the line which support the segment : $ax + by + c = 0 $ , a, b, c depending of  the extremas of your segment.

*compute (second order polynome) the intersection : there is 2 points maximum.

*check if intersection is in the segment


Enjoy ;-)
