C-S(Cohen-Sutherland)直线段裁剪算法因直线段分类的不完全和直线与窗口边界求交点次数多而降低算法效率.提出了一种改进C-S裁剪算法,基本思想是首先根据裁剪窗口的顶点与直线的关系对直线的分类条件进行改进,然后利用直线分类时运算的符号值判断直线与窗口边的相交情况.改进的算法能准确地判断出三类直线,同时,在不需要任何辅助操作与运算的情况下,使得求交点次数降为最多两次,大大提高算法的效率.算法思想简单,直线判断与裁剪过程容易,有利于编程实现,而且该算法可推广到任意凸多边形裁剪窗口.
C-S(Cohen-Sutherland)segment clipping algorithm is lower efficiency because line segment classification is not completely and there are four intersection operations of line segment and window edge lines.In this paper,a modified C-S line-clipping algorithm based on sign judgment is proposed.The basic idea is that the line classification conditions was improved by sign relations of four windows vertex and line firstly,then the fact intersection of line and window edges was judged using the sign once again.The modified algorithm with out only judge three line types exactly and completely,but also reduce intersection to two numbers not any auxiliary operation and calculation.The modified algorithm is simple and efficiency,line judgment,clipping process and programming is easy,and the algorithm can be extended to arbitrary convex polygon clipping window.