- 0
- 0
- 约4.68千字
- 约 44页
- 2018-05-15 发布于四川
- 举报
The algorithm seeks to select the optimum raster locations that represent a straight line. 2. error This algorithm always increments by one unit in x. The increment in y, either zero or one, is determined by examining the distance --error. (x, y +ε)的下一个点为(x, y + ε + m),这里ε为累加误差。可以看出,当ε+m 0.5时,绘制(x + 1, y)点,否则绘制(x + 1, y + 1)点。 So: the algorithm is cleverly constructed so that only the sign of the error term need be examined. error term = (ε+m ) - 0.5 If error term 0, then down; else up. 2. illustrated 4. The initial value of error if the slope of the line is less than 0.5, the error term’s value at the next raster point one unit away, (1,0), is determined by adding the slope of the line to the error term. e = e + m 5. Derivation of formulas: e = e + m e = e + m 6. An example 6. Bresenham’s line rasterization algorithm for the first octant 7. Integer Bresenham’s Algorithm e = e + m Again, incrementing the error term by the slope yields at the next raster point(2,0). e= -1/8 + 3/8 = ? e = e + m When e is positive, which shows that the line passes above the midpoint. The raster element at the next higher vertical location (2,1) better approximates the position of the line; hence y is incremented by one unit. e = e + m - 1 Before considering the next pixel, it is necessary to reinitialize the error term. This is accomplished by subtracting 1 from it, thus e = e - 1, e = ? - 1= - ? Or: e = e + m - 1, e = -1/8 + 3/8 - 1 = ? - 1 e = e + m(Optional) Notice that the intercept of the vertical line at x=2 and the desired line is –0.25 with respect to the line y = 1. Reinitializing to –0.5 relative to zero for the error term yields, as above, -3/4. e = e + m continuing to the next raster unit yields: e = - ? + 3/8 = -3/8 e is negative, thus the y value is not incremented. Error propagation e = e + m From the previous discussion, it is easy to see that the error term is a measure of the y intercept of the desired line at each
您可能关注的文档
- 金属班第十一章稀土冶金学1.ppt
- 2007动感地带两岸娱乐英雄.ppt
- 统计技术幻灯.ppt
- 生活中的药品化学.ppt
- 第四章 MATLAB与过程控制系统仿真 (1).ppt
- 通风与防尘工程i.ppt
- 马克思基本理论第二章.ppt
- 北大光华《战略管理》221页.ppt
- 新老会计准则差异.ppt
- 工图——第5章 标准件及常用件.ppt
- 小区绿化施工协议书.docx
- 墙面施工协议书.docx
- 1 古诗二首(课件)--2025-2026学年统编版语文二年级下册.pptx
- (2026春新版)部编版八年级道德与法治下册《3.1《公民基本权利》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《4.3《依法履行义务》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.2《按劳分配为主体、多种分配方式并存》PPT课件.pptx
- (2026春新版)部编版八年级道德与法治下册《6.1《公有制为主体、多种所有制经济共同发展》PPT课件.pptx
- 初三教学管理交流发言稿.docx
- 小学生课外阅读总结.docx
- 餐饮门店夜经济运营的社会责任报告(夜间贡献)撰写流程试题库及答案.doc
原创力文档

文档评论(0)