Computer Engineering and Applications ›› 2012, Vol. 48 ›› Issue (34): 175-178.

Previous Articles     Next Articles

Modified Sutherland-Cohen line clipping algorithm

LI Zhulin, LEI Gang   

  1. Institute of Computer Science, Yan’an University, Yan’an, Shaanxi 716000, China
  • Online:2012-12-01 Published:2012-11-30

一种改进的Sutherland-Cohen裁剪算法

李竹林,雷  岗   

  1. 延安大学 计算机学院,陕西 延安 716000

Abstract: Cohen-Sutherland clipping algorithm is lower efficiency because of four intersection operations of line segment and window edge lines. In this paper, a modified Sutherland-Cohen line clipping algorithm is proposed. The line in the window or out the window completely is judged. The auxiliary line is decided according by the coding of a line endpoint, and one of edges of the window is deduced to compute the point of intersection with the line by the relation of three points on a plane. The modified algorithm makes intersection operation be twice at most, avoiding to compute the slope and distance, can improve the efficiency of the algorithm greatly. The thought is simple, the operation is convenient, hardware implementation is easy, and is important practical value for graphics applications.

Key words: Cohen-Sutherland clipping algorithm, line classification, auxiliary line, sign

摘要: Cohen-Sutherland裁剪算法因直线与窗口边界求交点次数多而降低算法效率。提出了一种改进Sutherland-Cohen裁剪算法,将完全在窗口内和窗口外的直线判断出来,根据直线端点编码确定辅助线,利用平面上三点的关系判断直线与窗口的哪条边相交。改进的算法使得求交点次数降为最多两次,且避免计算斜率与距离,大大提高算法的效率。算法思想简单,操作方便,有利于硬件实现,对图形学的应用具有重要的实用价值。

关键词: Cohen-Sutherland裁剪算法, 直线分类, 辅助线, 符号