Intersection between line and circle+ values?

3 ビュー (過去 30 日間)
Tarek Alnajjar
Tarek Alnajjar 2015 年 4 月 25 日
編集済み: Roger Stafford 2015 年 4 月 27 日
consider a line and a circle
Given:(a,b) is the center of the circle, and (r) is the radius.
Given: (x0,y0), (xf,yf) are the start and the end point of the line.
1.Write the parametric equation of the line.
2.Write the parametric equation of the circle.
3.find the value of (t) at the intersection between the line and circle
4.Based on 3 what is the value of (x) and (y) at the intersection.
  3 件のコメント
Tarek Alnajjar
Tarek Alnajjar 2015 年 4 月 25 日
its not a homework I've done the first two but I don't understand part 3 and 4
pfb
pfb 2015 年 4 月 26 日
This is a forum about programming with matlab.
How is this matlab-related?

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

回答 (1 件)

Roger Stafford
Roger Stafford 2015 年 4 月 27 日
編集済み: Roger Stafford 2015 年 4 月 27 日
Let P1 and P2 each be two-element column vectors with the coordinates of two points on the line, let C be the column vector of the circle's center coordinates, and let r be the circle's radius. If the line and the circle do intersect, I1 and I2 below will be vectors of the two points of intersection.
A = P1-C;
B = P2-P1;
d2 = dot(B,B);
t = (r^2-dot(A,A))*d2+dot(A,B)^2;
if t < 0, error('There is no intersection.'), end
Q = P1-dot(A,B)/d2*B;
t2 = sqrt(t)/d2*B;
I1 = Q + t2;
I2 = Q - t2;

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by