given a circle plot all possible tangents
2 ビュー (過去 30 日間)
古いコメントを表示
So as the question says I would like to obtain all the tangents to a circle.
I came across the question mentioned below
but after executing it this is what i get
The circle looks like this
enclosed are the points of the circle,its center and radius info as well as the orignal set of points on which this was drawn
the code for drawign circle is
function Circ = circle(xc,yc,R,flag)
theta=0:pi/270:2*pi;
xcircle = R*cos(theta')+xc;
ycircle = R*sin(theta')+yc;
dxda=-R.*sin(theta);
dyda=R.*cos(theta);
dydx=dyda./dxda;
if flag
plot(xcircle,ycircle);
hold on;
end
Circ=[xcircle,ycircle];
Circ=Circ';
% for i=1:size(Circ,2)
% pt=[xcircle(i) ycircle(i)];
% intcpt = pt(2) - dydx(i).*pt(1); % Calculate Intercept
% xvct = pt(1)-1:pt(1)+1; % ‘x’ Vecor For Tangent
% tngt = dydx(i).*xvct + intcpt; % Calculate Tantent
% plot(pt(1),pt(2),'gp');
% plot(xvct,tngt);
% hold on;
%
% end
end
0 件のコメント
回答 (1 件)
Geoff Hayes
2021 年 9 月 28 日
Sparsh - the code from https://www.mathworks.com/matlabcentral/answers/258780-how-to-plot-tangent-line-from-specified-point-to-a-circle plots the tangent for one particular point on the circle. When I run the code (provided in the answer) I do not see the first image that you included above but instead see the tangent line at a single point. If you need to show all tangents, then you would need to update the code to loop through all points on the circle and draw the tangent for each.
As for your second image, how did you generate that? I almost think there is a different question being asked here.
4 件のコメント
Geoff Hayes
2021 年 9 月 29 日
sparsh - I'm not sure how your code is related to finding the tangents of the circle. What exactly are you asking help for?
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!