Finding intersection points in a square.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
Is there good way to find the intersection points in a square.

Also, can I get intersection points between the lines?
I spent pretty much time but cannot solve it. (I am practing MATLAB now)
Please help me..
0 comentarios
Respuestas (1)
Matt J
el 22 de Nov. de 2021
Editada: Matt J
el 22 de Nov. de 2021
Yes, you can use,
square=polyshape([0 0; 0 1; 1 1; 1 0]);
line=[0.01,1,-0.6];
out=linexlines2D(square,line) %intersections
plot(square)
hold on
fimplicit(@(x,y) [x(:),y(:),x(:).^0]*line(:));
plot(out(1,:),out(2,:),'o','MarkerFaceColor','r');
hold off
xlim([-1,2])
axis equal
0 comentarios
Ver también
Categorías
Más información sobre NaNs 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!
