intersections between circles and lines
Mostrar comentarios más antiguos
I have a matrix with the coordinates x,y of start of some lines and the matrix with coordinates x,y of end of each lines. I have also a vector with the centers of the circles and a vector with the radius. I would find the intersection points of these lines with circles. If a line intersects a circle, it is colored red. At the moment I wrote this code:
hold on
for i=1:3
theta = 0 : 0.01 : 2*pi;
radius = 3;
x = radius * cos(theta);
y =radius * sin(theta);
plot(x+xCenter(i), y+yCenter(i));
axis square;
grid on;
axis equal;
line(startxy,endxy)
end
For the moment I imposed a constant radius. You see a "cycle for" until 3 because I have imposed a vector with 3 rows, to try if the code works. Thanks for your help
Respuestas (1)
KSSV
el 29 de Mzo. de 2017
0 votos
Have a look on this file exchange function: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections
2 comentarios
gianluca scutiero
el 29 de Mzo. de 2017
KSSV
el 29 de Mzo. de 2017
Why to use line? You have to input coordinates for the curves.
Categorías
Más información sobre NaNs en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!