李竹林, 张根耀, 郭万鑫. 基于符号判断的C-S直线裁剪算法改进[J]. 微电子学与计算机, 2015, 32(8): 150-153. DOI: 10.19304/j.cnki.issn1000-7180.2015.08.032
引用本文: 李竹林, 张根耀, 郭万鑫. 基于符号判断的C-S直线裁剪算法改进[J]. 微电子学与计算机, 2015, 32(8): 150-153. DOI: 10.19304/j.cnki.issn1000-7180.2015.08.032
LI Zhu-lin, ZHANG Gen-yao, GUO Wan-xin. A Modified C-S Line Segment Clipping Algorithm Based on Sign Judgment[J]. Microelectronics & Computer, 2015, 32(8): 150-153. DOI: 10.19304/j.cnki.issn1000-7180.2015.08.032
Citation: LI Zhu-lin, ZHANG Gen-yao, GUO Wan-xin. A Modified C-S Line Segment Clipping Algorithm Based on Sign Judgment[J]. Microelectronics & Computer, 2015, 32(8): 150-153. DOI: 10.19304/j.cnki.issn1000-7180.2015.08.032

基于符号判断的C-S直线裁剪算法改进

A Modified C-S Line Segment Clipping Algorithm Based on Sign Judgment

  • 摘要: C-S(Cohen-Sutherland)直线段裁剪算法因直线段分类的不完全和直线与窗口边界求交点次数多而降低算法效率.提出了一种改进C-S裁剪算法,基本思想是首先根据裁剪窗口的顶点与直线的关系对直线的分类条件进行改进,然后利用直线分类时运算的符号值判断直线与窗口边的相交情况.改进的算法能准确地判断出三类直线,同时,在不需要任何辅助操作与运算的情况下,使得求交点次数降为最多两次,大大提高算法的效率.算法思想简单,直线判断与裁剪过程容易,有利于编程实现,而且该算法可推广到任意凸多边形裁剪窗口.

     

    Abstract: 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.

     

/

返回文章
返回