Comment detail

長方形の交差判定 (Nested Flatten)
標準でrectintという関数があるので引数を合わせただけ。コメントアウトしてある最後の三行は交差の状態を図示。
1
2
3
4
5
6
7
8
9
function a = checkrectoverlap(r1, r2)
%  returns positive value if two rectangles are overlapped, zero if not.
%  r1,r2: [left top right bottom]
rr1=r1-[0 0 r1(1:2)];
rr2=r2-[0 0 r2(1:2)];
a = rectint(rr1,rr2);
% rectangle('Position',rr1);
% rectangle('Position',rr2);
% axis equal

Index

Feed

Other

Link

Pathtraq

loading...