given a circle plot all possible tangents
6 次查看(过去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/751809/image.png)
The circle looks like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/751814/image.png)
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 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!