首页 开发技术 C++     /    计算机图形学示例(扫描线填充)

计算机图形学示例(扫描线填充)

上传者: fifa2001 | 上传时间:2025/7/20 4:20:18 | 文件大小:83KB | 文件类型:rar
计算机图形学示例(扫描线填充)
用VC++6.0实现的扫描线填充,裁剪算法及画线方法 CPenpen(PS_SOLID,1,fillcolor);//设置扫描线所用笔的属性 CPen*old=pDC->SelectObject(&pen); intj,k,s=0; intp[9];//每根扫描线交点 intpmin=1000; intpmax=0; for(inti=0;i<inLength;i++)//建立边表 { edge[i].dx=(float)(inVertexArray[i+1].x-inVertexArray[i].x)/(inVertexArray[i+1].y-inVertexArray[i].y); edge[i].num=i; if(inVertexArray[i].y<=inVertexArray[i+1].y) { edge[i].ymin=inVertexArray[i].y; edge[i].ymax=inVertexArray[i+1].y; edge[i].xmin=(float)inVertexArray[i].x; edge[i].xmax=(float)inVertexArray[i+1].x; } else{ edge[i].ymin=inVertexArray[i+1].y; edge[i].ymax=inVertexArray[i].y; edge[i].xmax=(float)inVertexArray[i].x; edge[i].xmin=(float)inVertexArray[i+1].x; } } //求多边形的最大最小值 for(intm=1;m<inLength;m++) { for(intn=0;n<inLength-m;n++) { if(pmaxinVertexArray[n].y) pmin=inVertexArray[n].y; } } for(intr=1;r<inLength;r++) //边表edge排序 { for(intq=0;q<inLength-r;q++) { if(edge[q].yminpmin;scan--)//扫描线遵守'“上开下闭”的原则 { intb=0; k=s; for(j=k;j=edge[j].ymin)&&(scan<=edge[j].ymax))//判断扫描线与线段是否相交于顶点 { intpreNum=edge[j].num; intnextNum=edge[j].num+1; if(preNum==0) preNum=inLength-1; else preNum=preNum-1; if(nextNum==inLength) nextNum=0; if(scan==edge[j].ymax)//位于下顶点时,根据相临点的位置决定取几个点 { if(inVertexArray[nextNum].y<edge[j].ymax) { b++; p[b]=(int)edge[j].xmax; } if(inVertexArray[preNum].yedge[j].ymin)&&(scan<edge[j]. 本软件ID:2497949

文件下载

资源详情

[{"title":"(22个子文件83KB)计算机图形学示例(扫描线填充)","children":[{"title":"clip.dsw <span style='color:#111;'>514B</span>","children":null,"spread":false},{"title":"res","children":[{"title":"clip.rc2 <span style='color:#111;'>396B</span>","children":null,"spread":false},{"title":"clip.ico <span style='color:#111;'>1.05KB</span>","children":null,"spread":false}],"spread":true},{"title":"clip.cpp <span style='color:#111;'>1.99KB</span>","children":null,"spread":false},{"title":"clip.dsp <span style='color:#111;'>4.28KB</span>","children":null,"spread":false},{"title":"clip.opt <span style='color:#111;'>50.50KB</span>","children":null,"spread":false},{"title":"Vertex_Count.cpp <span style='color:#111;'>1.05KB</span>","children":null,"spread":false},{"title":"clip.ncb <span style='color:#111;'>233.00KB</span>","children":null,"spread":false},{"title":"VertexNo.h <span style='color:#111;'>1.18KB</span>","children":null,"spread":false},{"title":"Vertex_Count.h <span style='color:#111;'>1.21KB</span>","children":null,"spread":false},{"title":"clip.clw <span style='color:#111;'>2.02KB</span>","children":null,"spread":false},{"title":"StdAfx.cpp <span style='color:#111;'>206B</span>","children":null,"spread":false},{"title":"resource.h <span style='color:#111;'>1.07KB</span>","children":null,"spread":false},{"title":"VertexNo.cpp <span style='color:#111;'>1.00KB</span>","children":null,"spread":false},{"title":"clip.plg <span style='color:#111;'>2.78KB</span>","children":null,"spread":false},{"title":"clipDlg.h <span style='color:#111;'>2.95KB</span>","children":null,"spread":false},{"title":"clipDlg.cpp <span style='color:#111;'>20.36KB</span>","children":null,"spread":false},{"title":"clip.aps <span style='color:#111;'>35.57KB</span>","children":null,"spread":false},{"title":"StdAfx.h <span style='color:#111;'>1.03KB</span>","children":null,"spread":false},{"title":"clip.rc <span style='color:#111;'>6.42KB</span>","children":null,"spread":false},{"title":"clip.h <span style='color:#111;'>1.27KB</span>","children":null,"spread":false},{"title":"ReadMe.txt <span style='color:#111;'>3.46KB</span>","children":null,"spread":false}],"spread":true}]

评论信息

  • huangshuoq:
    很有用!不错!2015-11-23
  • ShenYisu:
    谢谢啦,很有帮助2014-05-12
  • Lilys_:
    算法实现很标准,简洁明了2013-11-21
  • a290425217:
    算法实现很标准,简洁明了2012-04-23

免责申明

【好快吧下载】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【好快吧下载】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【好快吧下载】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,8686821#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明