Intersection between line and circle

Please check the image above
I need to find the intersection point of the line with the circle 3 and circle 4.
If I use linecirc() command, i get the values of circle 1 also.
Is there any other command to get the required values ?
Thanks in advance

 採用された回答

Image Analyst
Image Analyst 2014 年 7 月 27 日
編集済み: Image Analyst 2014 年 7 月 27 日

1 投票

Each circle with have either 0, 1, or 2 intersection points. Do you have the formula for each circle, meaning it's center coordinates and radius ? If seems like knowing the formulas for the lines you might be able to use fzero() to find the intersection point(s).
By the way, what toolbox is linecirc() in? I don't have it.

3 件のコメント

Selva
Selva 2014 年 7 月 27 日
Thanks for the response
linecirc() comes under mapping toolbox
I have the center and radius of all circles
Image Analyst
Image Analyst 2014 年 7 月 27 日
編集済み: Image Analyst 2014 年 7 月 27 日
I will add it to the Products list for you. Does that give the 0, 1, or 2 intersection points?
Selva
Selva 2014 年 8 月 21 日
編集済み: Image Analyst 2014 年 8 月 21 日
2 intersection points if it cuts the circle
2 same points if its a tangent
Nan if its does not intersect with the circle

サインインしてコメントする。

その他の回答 (1 件)

Matt J
Matt J 2014 年 7 月 27 日
編集済み: Matt J 2014 年 7 月 27 日

1 投票

Find all points of intersection and write each in the form
P_intersection = P1+t*(P2-P1)
where t is a scalar parameter. Solve for each t by doing
t = (P2-P1)\(P_intersection-P1)
Then discard all intersections other than the ones for which 0<=t<=1. The intersections that remain will all lie on the line segment between P1 and P2.

質問済み:

2014 年 7 月 27 日

編集済み:

2014 年 8 月 21 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by