Possible Duplicate:
Circle line collision detection
How do I find the intersection of a circle and a line (not straight) with different slope.
The points for the line is shown below:
theta=0:.01:2*pi;
x1=5*cos(theta)+4;
y1=5*cos(theta)+1;
x=[1 1 4 7 7 8 8 8]
y=[2 3 3 3 5 8 8 8]
And also, how do I calculate the length of this line?
If you have a polyline, use the mathematical formula contained here on each individual straight line segment of your polyline. You have asked this question before so you should be able to do it for a single line segment. All you need to to is break your polyline into its constituent parts and solve the problem for each one and store the intersection points.