Hi,
Apologies if this is considered a repeat question, but the answers I've seen on here are too complex for my needs.
I simply need to find out if a line segment intersects a circle. I don't need to find the distance to the line from the circle center, I don't need to solve for the points of intersection.
The reason I need something simple is that I have to code this in SQL and am unable to call out to external libraries, and need to write this formula in a WHERE clause... basicaly it has to be done in a single statement that I can plug values in to.
Assuming 2 points A (Ax,Ay) and B (Bx,By) to describe the line segment, and a circle with center point C (Cx,Cy) and radius R, the formula I am currently using is:
( R*R* ( (Ax-Bx)(Ax-Bx) + (Ay-By)(Ay-By) ) ) -( ((Ax-Cx)(By-Cy))-((Bx-Cx)(Ay-Cy)) ) > 0
This formula is taken from link text, and is based on a 0,0 centered circle.
The reason I am posting is that I am getting weird results and I wondered if I did something stupid. :(