Computer Engineering and Applications ›› 2013, Vol. 49 ›› Issue (6): 180-182.

Previous Articles     Next Articles

Performance analysis on line two-dimensional clipping and drawing algorithm

ZHANG Yicheng, FENG Xiquan   

  1. No.29 Institute, China Electronics Technology Group Corporation, Chengdu 610036, China
  • Online:2013-03-15 Published:2013-03-14

线段二维裁剪与绘制的算法性能分析

张以成,冯西权   

  1. 中国电子科技集团公司 第二十九研究所,成都 610036

Abstract: Several algorithms in computer graphics for two-dimensional line clipping and drawing are analyzed and discussed in this paper. In order to improve the accuracy of plotting and calculation speed, the implementation of these algorithms through experiments in the windows platform by using C language and a DirectDraw interface are done. The comparison of each algorithm performance is made by using different experimental parameters. Analysis results show that accuracy and cost of line clipping can benefit a lot from the process of accumulative errors and to round up or down in division. Experimental results show that by using the optimal tree algorithm for two-dimensional line clipping and the run length slice algorithm for line drawing can efficiently complete the display task. A good reference value for computer graphics can be obtained in this test.

Key words: computer graphics, line clipping, line drawing, graphic interface

摘要: 分析与讨论了几种线段二维裁减和绘制算法,为了提高图形绘制的精确度和计算速度,通过实验在Windows平台上利用C语言和DirectDraw接口实现了这些算法。针对不同的实验参数,对各个算法性能作出了比较。分析结果显示:在实现过程中可以对直线裁剪的累计误差处理,对整数除法的四舍五入处理等细节改良,从而使得绘制的图形更加精确,付出的代价非常小。实验结果表明,采用最优树裁剪算法对线段进行二维裁剪并利用步距长度片算法进行绘制,能够高效完成显示任务,结果具有较好的参考价值。

关键词: 计算机图形学, 线段裁剪, 线段绘制, 图形图像接口