⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intersectp.m

📁 自己编写的 matlab gui 可以实现任意多边形定点参数输入 然后使用Sutherland_Hodgeman等算法进行多边形被矩形截取的演示程序
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -