The Line Clipping Algorithm Basing on Affine
Transformation
Wenjun Huang
College of Math and Computer Science, Guangxi University for Nationalities, Nanning, China
E-mail: hwjart@126.com
Received March 20, 2010; revised April 25, 2010; accepted May 27, 2010
Abstract
A new algorithm for clipping line segments by a rectangular window on rectangular coordinate system is presented in this paper. The algorithm is very different to the other line clipping algorithms. For the line segments that cannot be identified as completely inside or outside the window by simple testings, this algorithm applies affine transformations (the shearing transformations) to the line segments and the window, and changes the slopes of the line segments and the shape of the window. Thus, it is clear for the line segment to be outside or inside of the window. If the line segments intersect the window, the algorithm immediately (no solving equations) gets the intersection points. Having applied the inverse transformations to the intersection points, the algorithm has the final results. The algorithm is successful to avoid the complex classifications and computations. Besides, the algorithm is effective to simplify the processes of finding the intersection points. Comparing to some classical algorithms, the algorithm of this paper is faster for clipping line segments and more efficient for calculations.
Keywords: Computer Graphics, Line Clipping, Algorithm, Affine Transformation
1. Introduction and Previous Work
In computer graphics, line clipping is a basic and important operation, and has many applications. For example, extracting part of a defined scene for viewing must take line clipping. The region that includes the part of the defined scene is called a clip window. Generally, the window is a rectangle or a general
References: Computers and Graphics, Vol. 18, No. 4, 1994, pp. 517527. Eurographics’92 Conference, Cambridge, 1992, pp. 1-38.