Possible Duplicate:
Circle line collision detection
I have a problem. I need to find point A.

How can I do this best way?
Programming languale is Java.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given:
a circle with center C=[x2,y2] and radius R
a line segment from C to B=[x1,y2]
calculate their intersection.
This is easy since one of the endpoints is the center of the circle. You have to walk the distance of R from C towards B. The distance guarantees you will end up on the circle and the direction guarantees you will end up on the ray C->B. You still need to check if the intersection lies on the segment.
Here is the pseudocode if you have a vector library
Without a library, the code is longer: