计算机图形学实验报告三_第1页
计算机图形学实验报告三_第2页
计算机图形学实验报告三_第3页
计算机图形学实验报告三_第4页
计算机图形学实验报告三_第5页
全文预览已结束

下载本文档

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

文档简介

1、西安工程大学实验报告课程计算机图形学实验名称bezier曲线第 页共页系别计算机科学学院实验 日期2016年6月28日专业班级数字媒体技术组别实验报告日期年 月日姓名学号报告退发(订正、重做)e mail:教师审批评分实验名称一、实验目的和任务(1) 掌握直线的参数表示法。(2) 掌握德卡斯特里奥算法的几何意义。(3) 掌握绘制二维bezier曲线的方法。(4) 使用鼠标左键绘制个数为10以内的任意控制点,使用直线 连接构成控制 多边形。(5) 使用鼠标右键绘制bezier曲线。(6) 在状态栏显示鼠标的位置坐标。(7) bezier曲线使用徳卡斯特里奥算法绘制。二、实验环境和设备(关于实验或

2、者开发环境的描述,包括机器类型、内存、cpu主频、操作系统、 网络环境、开发语言、开发平台等)机器类型:dell pc内存:4gbcpu 主频:3. 2ghz操作系统:windows 10开发语言:c+开发平台:micro soft visual c+6. 0三、实验步骤和过程/ bezierview. cpp : implementation of the cbezierview class / #include "stdafx. h#inelude "bezier.h"#inelude "beierdoc.h#include "bezier

3、view. h"#ifdef _debug#define new debug_new#undef this_filestatic char this_f1le = _f1le_;#endif/i/ cbezierviewimplement_dyncreate(cbezierview, cview)begin message map(cbezierview, cview)/afx_msg_map(cbezierview)/ note - the classwizard will add and remove mapping macros here./ do not edit what

4、you see in these blocks of generated code!/afx_msg_map/ standstd printing commandson_cofmand(td_fti,e_prtnt, cview: :onfileprint)on.command(1d_f1le_pr1nt_d1rect, cview:0nf订eprint)on.command(id_file_print_preview, cview:onfi1eprintpreview) end_message_map()/ cbezierview construct ion/destructioncbezi

5、erview:cbezierview()/ todo: add construction code herecbezierview:cbezierview()bool cbezierview:precreatewindow(createstruct& cs)ri/ todo: modify the window class or styles here by modifying/ the createstruct csreturn cview:precreatewindow(cs);/ cbezierview drawingvoid cbezierview:ondraw(cdc* pd

6、c)cbezierdoc* pdoc = getdocument();assert_valld(pdoc);/ todo: add draw code for native data herepdc->moveto(cpoint(100, 350);pdc->lineto(cpoint(190, 100);pdc->lineto(cpoint (300,60);pdc->lineto(cpoint(500, 300);beziercurve(cpoint(100, 350),cpoint(190, 100), cpoint(300, 60), cpoint(500, 3

7、00), 100, pdc);/ cbezierview printingbool cbezierview:onprepareprinting(cprintinfo* plnfo)/ default preparationreturn doprepareprinting(plnfo);void cbezierview:onbeginprinting(cdc* /*pdc*/, cprintlnfo* /*plnfo*/)/ todo: add extra initislization before printingvoid cbezierview:onendprinting(cdc* /*pd

8、c*/, cprintlnfo* /*plnfo*/)/ todo: add cleanup after printing/i/!/ cbezierview diagnostics#ifdef debugvoid cbezierview:assertvalido constcview:assertvalid();void cbezicrvicw:dump(cdumpcontext& de) const cvi ew:dump (de);cbezierdoc* cbezierview:getdocument () / non-debug version is inline assert(

9、m_pdocument->iskindof(runttmeclass(cbezierdoc); return (cbezi erdoc*)m_pdocument;#endif /_debug / / cbezierview message handlers void cbezierview:beziercurve(cpoint po, cpoint pl, cpoint p2, cpoint p3, int count, cdc *dc)double t = 0. 0;double dt = 1.0/count;dc->moveto(po. x, po. y);cpen pen(p

10、s_solid, 2, rgb (255, 0,0);cpen *01dpen = de-sei ectobject (&pen);t = t + dt;for(int i二0;icount+l;+i)doublef1,f2, f3, f4,doubleu=1.0-t;flu*u* u;f23*t* u * u;f33*t*t * u;f4t*t* t;xx, y;p0. x*fl + pl.x*f2 + p2 x*f3 + p3.x*f4;p3. y*f4;y = p0. y*fl + pl.y*f2 + p2. y*f3 dc->lineto(int)x, (int)y);t += dt;dc->seiect0bject(oldpen); 創 hl/<<!x vltlb”

温馨提示

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

评论

0/150

提交评论