Returning True if the Line Intersects with Any Rectangle
4 次查看(过去 30 天)
显示 更早的评论
Hi all, I have a rectangles shown as below and also the code is attached. I want to return true if any line crosses any rectangle. The coordinates of the lines do not matter, you can guess them, if you want to try.
![2019-12-27_23-59-15.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/257419/2019-12-27_23-59-15.png)
thanks
0 个评论
回答(1 个)
Walter Roberson
2019-12-27
"The intersection of groups of curves (e.g. contour lines, multiply connected regions etc) can also be computed by separating them with a column of NaNs"
So construct entries describing all of your rectangles together, separated by NaN, and then you can ask for the intersection of your line(s) with that.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!