图形学实验四_Sutherland-Hodgman多边形裁剪算法实验报告_第1页
图形学实验四_Sutherland-Hodgman多边形裁剪算法实验报告_第2页
图形学实验四_Sutherland-Hodgman多边形裁剪算法实验报告_第3页
图形学实验四_Sutherland-Hodgman多边形裁剪算法实验报告_第4页
图形学实验四_Sutherland-Hodgman多边形裁剪算法实验报告_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、计算机图形学实验报告裁剪算法实验姓名 闫学森 学号 3013216087 专业 计算机 班级 3班 天津大学计算机科学与技术学院2015年 12 月 1日一、实验目的实现sutherland-hodgman多边形裁剪算法二、实验内容自定义裁剪窗口和待裁剪直线段(或多边形),采用不同颜色突出显示裁剪结果三、实验结果四、实验分析和总结sutherland-hodgman多边形裁剪算法是将原多边形进行左右下上四次裁剪。其中进行两次分解 第一次分解:将多边形关于矩形窗口的裁剪分解为它关于窗口四条边所在直线的裁剪; 第二次分解:将多边形关于一条直线的裁剪分解为多边形各边关于该直线的裁剪。四次裁剪相似,只

2、要修改部分变量即可。但是第一次修改时没有完全改掉,出来的图像不正确。通过这次试验使我了解到如何运用计算机程序对窗口进行剪裁,了解到编码剪裁算法直观方便,速度较快,中点分割剪裁算法不用进行乘除运算,剪裁效率高, sutherland-hodgman直线裁剪算法更快。五、源代码/ polygonclipdemo.cpp : defines the class behaviors for the application./#include "stdafx.h"#include "polygonclipdemo.h"#include "mainfrm.

3、h"#ifdef _debug#define new debug_new#endif/ cpolygonclipdemoappbegin_message_map(cpolygonclipdemoapp, cwinapp)on_command(id_app_about, onappabout)end_message_map()/ cpolygonclipdemoapp constructioncpolygonclipdemoapp:cpolygonclipdemoapp()/ todo: add construction code here,/ place all significan

4、t initialization in initinstance/ the one and only cpolygonclipdemoapp objectcpolygonclipdemoapp theapp;/ cpolygonclipdemoapp initializationbool cpolygonclipdemoapp:initinstance()/ initcommoncontrols() is required on windows xp if an application/ manifest specifies use of comctl32.dll version 6 or l

5、ater to enable/ visual styles. otherwise, any window creation will fail.initcommoncontrols();cwinapp:initinstance();/ standard initialization/ if you are not using these features and wish to reduce the size/ of your final executable, you should remove from the following/ the specific initialization

6、routines you do not need/ change the registry key under which our settings are stored/ todo: you should modify this string to be something appropriate/ such as the name of your company or organizationsetregistrykey(_t("local appwizard-generated applications");/ to create the main window, t

7、his code creates a new frame window/ object and then sets it as the application's main window objectcmainframe* pframe = new cmainframe;m_pmainwnd = pframe;/ create and load the frame with its resourcespframe->loadframe(idr_mainframe,ws_overlappedwindow | fws_addtotitle, null,null);/ the one

8、and only window has been initialized, so show and update itpframe->showwindow(sw_show);pframe->updatewindow();/ call dragacceptfiles only if there's a suffix/ in an sdi app, this should occur after processshellcommandreturn true;/ cpolygonclipdemoapp message handlers/ caboutdlg dialog used

9、 for app aboutclass caboutdlg : public cdialogpublic:caboutdlg();/ dialog dataenum idd = idd_aboutbox ;protected:virtual void dodataexchange(cdataexchange* pdx); / ddx/ddv support/ implementationprotected:declare_message_map();caboutdlg:caboutdlg() : cdialog(caboutdlg:idd)void caboutdlg:dodataexchange(cdataexchange* pdx)cdialog:dodataexchange(pdx);begin_message_map(caboutdlg, cdialog)end_message_ma

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论