how to filter out the line that intersects with another line?

1 visualización (últimos 30 días)
Sierra
Sierra el 11 de Oct. de 2022
Editada: Matt J el 11 de Oct. de 2022
I want to filter out the line when it intersects with another line.
I only need the line before instecting with another line.
I found the function that calculate intersection point. but in my case i don't need a point. I just need to filter out the line after intersection.
Thanks.
  2 comentarios
Ghazwan
Ghazwan el 11 de Oct. de 2022
can you share the code?
Jan
Jan el 11 de Oct. de 2022
@Sierra: What are the inputs? How are the lines defined? With start and end point, or with start point, direction an lengths?
What does "filter out" mean? Having the intersection point sounds like the solution, because it is the new end point.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 11 de Oct. de 2022
You can use intersectionHull from this FEX download,
Use the upward sloping line to define inequality constraints for the desired region.
  1 comentario
Matt J
Matt J el 11 de Oct. de 2022
Editada: Matt J el 11 de Oct. de 2022
For example,
V1=[-1 +1;
+2 -2]; %downsloping line
V2=[-1 -1;
+1 +1]; %upsloping line
[~,~,A,b]=vert2lcon(V2)
V3=intersectionHull('vert',V1,'lcon',A,b).vert;
close all
lfn=@(v,varargin) line(v(:,1),v(:,2),varargin{:});
lfn(V1)
lfn(V2)
lfn(V3,Color='r',Marker='o')
shg

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by