计算机图形学交互技术与用户接口2.ppt_第1页
计算机图形学交互技术与用户接口2.ppt_第2页
计算机图形学交互技术与用户接口2.ppt_第3页
计算机图形学交互技术与用户接口2.ppt_第4页
计算机图形学交互技术与用户接口2.ppt_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

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

文档简介

1、1,Midpoint Line Algorithm (13),2,此时,可利用两候选点的中点与直线的位置关系,选出更接近直线的候选点,Midpoint Line Algorithm (14),3,点/线位置关系的判别计算,采用增量计算方法优化判别公式的计算,Midpoint Line Algorithm (15),4,例:用中点画线法光栅化一条连接两点(0,0)和(5,2)的直 线段,写出计算过程。,Example(1),5,P(xi,yir),Bresenham 判别方法示意图,Bresenham Line Algorithm(1),P(xi,yi),(xi+1,yi+1),6,Bresen

2、ham Line Algorithm(1),?: how to calculate efficiently?,increment,7,Homework,1.请用增量式方法推导扫描转换斜率00)的线段的Bresenham算法,写出推导过程。 2.如何消除上述算法中的浮点数?并试将该算法推广到可以扫描转换任意直线段。,8,Bresenham Line Algorithm(3),9,Bresenham Line Algorithm(4),Initializtion:,Iteration:,10,Bresenham Line Algorithm(5),Eliminate fraction:在判别式两边

3、同乘以2x,Initializtion:,Iteration:,11,Additional Issues(1),Endpoint order: make sure that a line from P0 to P1 contains the same set of pixels as the line from P1 to P0,12,Additional Issues(2),Starting at the edge of a clip rectangle,Fig. 3.10 Starting the line at a clip boundary. (a) Intersection with

4、 a vertical edge (b) Intersection with a horizontal edge (gray pixels are on the line but are outside the clip rectangle).,13,Additional Issues(3),Varying the intensity of a line as a function of slope Outline primitives composed of lines,14,SCAN CONVERTING CIRCLES,Original definition,To found pixel

5、s which lie on or nearest to the arc; The maximum number pixels that we can do.,15,Representation of circle,equivalent definitions,16,Inefficient algorithms,17,(xc,yc),(x,y),(x,y),(x+ xc,y+ yc),Representation of circle,18,Representation of circle,translated to the origin by integer amounts scan conv

6、erted with pixels written with the appropriate offset.,19,(x,y),Origin,(x,-y),(-x,y),(-x,-y),X-axis,y=x line,(y,x),Y-axis,Characteristic of circles,Eight-Way Symmetry,20,The problem,To find the set of pixels that close to the arc:,The tangent slope satisfies:,21,Characteristic of circles,22,Principl

7、e of midpoint algorithm,Decision variable:,?: how to calculate dk efficiently?,increment,23,Cont.,Float point!,24,Cont.,Let:,Alternative method:,Then the initialization becomes,25,Summary,26,Second-order difference,提高计算效率,类似地:,27,Homework,用中点算法的二级增量算法递推计算扫描转换圆心在(2,5),半径为11的圆的第一个1/4圆弧的过程。,28,Answer,p

8、utpixel(x+2,y+5), (y+2,x+5),29,中点画圆算法(1),原理:,30,中点画圆算法(2),定义圆函数:,特点:,引入判别参数:,31,中点画圆算法(3),算法描述: (假设X方向的步长为1),问题:如何快速计算判别参数的值?,32,中点画圆算法(4),使用增量计算方法改进判别参数的计算效率,33,中点画圆算法(5),关于计算效率的考虑:消除浮点运算 考虑:点的选择只与判别量的符号相关 引入:,另一种方式:,34,中点画圆算法(6),35,中点画圆算法(7),提高计算效率,类似地:,36,中点画圆算法(8),Void MidPointCircle(int r, int color) int x,y,d; x=0;y=r;d=1-r; delta1=3;delta2=5-2r; putpixel(x,y,color); while(yx) if(

温馨提示

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

评论

0/150

提交评论