how to filter out the line that intersects with another line?
조회 수: 1 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1152303/image.png)
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
채택된 답변
Matt J
2022년 10월 11일
You can use intersectionHull from this FEX download,
Use the upward sloping line to define inequality constraints for the desired region.
댓글 수: 1
Matt J
2022년 10월 11일
편집: Matt J
2022년 10월 11일
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1152628/image.png)
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!