【发布时间】:2014-05-07 14:09:21
【问题描述】:
我想用一种颜色绘制 2 个矩形的重叠区域。我知道我可以使用 rectangle 命令绘制矩形。使用 rectint 我可以找出它们是否重叠。
是否有特定的命令或者有谁知道我该怎么做?正如您所注意到的,我对 Matlab 没有太多经验。
代码:
A = [0 0 3 3];
B = [2 2 2 2];
hold on;
rectangle('Position',A) %plot rectangle A
rectangle('Position',B) %plot rectangle B
if (rectint(A,B) > 0)
%plot overlapping
end
hold off;
图片:
【问题讨论】:
-
半透明矩形不是一个好的解决方案吗?
-
因为我将使用它来构建本地化地图,所以我宁愿用一个正方形来代表信念。
标签: matlab plot overlap figure