title: line and circle intersection
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/11510330/intersection-of-line-and-circle-with-different-slope">intersection of line and circle with different slope</a>  </p>
  </blockquote>
  
  
  
  <p>I have line which plotted by <code>pp=randi([-400 400],2,2)</code> then <code>x=pp(:,1)</code> and <code>y=pp(:,2)</code>. I have a circle with centre (a,b) with radius r</p>
  
  <p>I want to check the intersection point of circle and the line. </p>
  
  <p>I have used <code>polyfit</code> command to check the slope and intercept. Then I used <code>lincirc</code> command but the problem is if the line crosses only one point then the other point is also shown. </p>
  
  <p>For example, if the line crosses one side and stops in the middle, it shows the other point as well which will not cross the boundary </p>