findmiddlepoint.m

来自「自己编写的 matlab gui 可以实现任意多边形定点参数输入 然后使用Sut」· M 代码 · 共 19 行

M
19
字号
function p0=findmiddlepoint(p1,p2,zonepoint)
p0=(p1+p2)/2;   %find the middle point;
codep0=getzonecode(zonepoint,p0);
codep1=getzonecode(zonepoint,p1);
codep2=getzonecode(zonepoint,p2);
while codep0~=0     %if the middle point is not in the area, continue to find it
    p0=(p1+p2)/2;   %find the middle point;
    codep0=getzonecode(zonepoint,p0);
    if codep0==0    %this point is in the area break;
        break;
    else    %this p0 is not in the area
        judge1=bitand(codep0,codep1);
        if judge1~=0     %means the p1 can be replaced by p0
            p1=p0;
        else p2=p0;
        end
    end
end
        

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?