intersectp.m
来自「自己编写的 matlab gui 可以实现任意多边形定点参数输入 然后使用Sut」· M 代码 · 共 27 行
M
27 行
function p=intersectp(p1,p2,zonepoint,error,andbit,type)
e=99999;
while (e>=error)
p0=(p1+p2)/2; %find the middle point;
code=getzonecode(zonepoint,p0);
code=bitand(code,andbit); %only judge the first window line
if type~=0 %means p1 outside the area while p2 inside
if code~=0 %the middle point is outside the area
e=norm(p1-p0);
p1=p0;
else %the middle point is inside the area
e=norm(p2-p0);
p2=p0;
end
else %means p1 inside the area while p2 outside
if code~=0 %the middle point is outside the area
e=norm(p2-p0);
p2=p0;
else %the middle point is inside the area
e=norm(p1-p0);
p1=p0;
end
end
end
p=p0;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?