-2

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?

Community
  • 1
  • 1
Justin Oommen
  • 13
  • 1
  • 7
  • 1
    [What have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Jonathon Reinhart Jul 16 '12 at 20:13
  • 2
    Are the only questions you're ever going to ask here about the [intersection](http://stackoverflow.com/q/11510330) of [circles](http://stackoverflow.com/q/11508932) and [lines](http://stackoverflow.com/q/11494878)? – Robert Harvey Jul 16 '12 at 20:22

1 Answers1

0

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.

mathematician1975
  • 21,161
  • 6
  • 59
  • 101