📄 isneighbour.m
字号:
%ISNEIGHBOUR Check if line segments are adjacent.% ISNEIGHBOUR(RAWSEGS,I,J,OVERLAP,CYC) returns 1 if segments I% and J are adjacent (with OVERLAP = 0) or if segments I and J% are adjacent *and* overlap (with OVERLAP = 1). Takes into% account cyclic (CYC = 1) and noncyclic (CYC = 0) scans. Uses% the RAWSEGS matrix defined in EXTRACTLINES.%% See also EXTRACTLINES.% v.1.0, 17.01.99, Kai Arras, ASL-EPFL% v.1.1, 07.12.02, Kai Arras, ASL-EPFL: overlap added% v.1.2, 30.09.03, Kai Arras, CAS-KTH: Bug fix in overlap conditionfunction bool = isneighbour(rawsegs,si,sj,overlap,cyc);nRawSegs = size(rawsegs,2);neighbour = 0;% Determine neighbourshipterminate = 0; i = 1;while (i <= nRawSegs) & ~terminate, if (i < nRawSegs) | cyc, j = mod2(i + 1, nRawSegs); if ((rawsegs(1,i)==si)&(rawsegs(1,j)==sj)) | ((rawsegs(1,i)==sj)&(rawsegs(1,j)==si)), terminate = 1; neighbour = 1; end; end; i = i + 1;end;% Determine overlapif neighbour & overlap, i = i - 1; % compensate last i increment is1 = rawsegs(2,i); ie1 = rawsegs(3,i); is2 = rawsegs(2,j); ie2 = rawsegs(3,j); c11 = (ie1 >= is1); c22 = (ie2 >= is2); c12 = (ie1 >= is2); c21 = (ie2 >= is1); if (c11 & c22 & c12 & c21) | (~c11 & c22 & c12 & ~c21) | ... (c11 & c22 & ~c12 & ~c21) | ( c11 & ~c22 & c12 & ~c21), bool = 1; else bool = 0; end;else bool = neighbour;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -