given a circle plot all possible tangents
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Geoff Hayes
el 28 de Sept. de 2021
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 comentarios
Geoff Hayes
el 29 de Sept. de 2021
sparsh - I'm not sure how your code is related to finding the tangents of the circle. What exactly are you asking help for?
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!