2d-line-cliiping - A n/p (NisualIter Introduction C lipping...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
(Nisual A n/p Iter 2D line and polygon clipping based on space subdivision Mel Slater* and Brian A. Barsky Computer Science Division Electrical Engineering and Computer Sciences University of California at Berkeley Berkeley, CA 94720, USA This paper introduces a new approach to 2D line and polygon clipping against a rectangular clipping region, using space subdivision into cells, with the clipping region as the central cell. The line segment path is traced through the cells, and en- tries into and out of the cell corresponding to the clipping region enable computation of the intersection of the line segment with crossed cell edges. Tracing the line seg- ment path is computationally very simple, leading to an algorithm that only com- putes intersections that are part of the clipped line segment. The new algorithm is compared to other standard line clip- ping algorithms with simulations and op- eration counts. Key words: Clipping - Line segment clip- ping - Polgon clipping - Computer graphics M. Slater on leave from Department of Computer Science, QMW University of London, Mile End Road, London El 4NS, UK Correspondence to: M. Slater Introduction Clipping is a fundamental stage in the viewing pipeline of computer graphics. It involves com- puting that part of a geometric primitive, such as a line segment or polygon, that is visible with respect to a clipping region. The simplest case occurs in 2D graphics where the clipping region is rectangular, and the primitive is a line segment. The major application is computing the part of a scene visible with respect to a window. Clipping is also often used for "pick input", that is deter- mining whether the cursor position is within a given tolerance of a geometric primitive, by testing the visibility of the primitive against a small rectangle which has the cursor position at its centre. There are three major approaches to the solution of the clipping problem. The first, known as the Cohen-Sutherland (CS) algorithm (Newman and Sproull 1979; Foley et al. 1990) uses a coding scheme of the line endpoints to reject quickly lines having both endpoints outside a particular clip- ping boundary, and accept quickly lines totally inside the clipping region. In other cases the line segment is truncated by intersecting it with one of the boundaries that it is known to cross, and the procedure is repeated with the truncated line. The second approach, parametric clipping, was intro- duced by Cyrus and Beck (1978) and by Liang and Barsky (1984) where the line segment is repres- ented in parametric form, as shown in, for example, Eq. (1). x(t) = xl + t(x2 -- Xa) y(t) = y~ + t(y2 - Yl) (0 < t < 1) (1) In the case of the Liang-Barsky algorithm (LB), the values of the parameter t corresponding to the points where the extended line segment intersects the clipping boundaries are used to find the clip- ped line segment. Initially these values are 0 and l, corresponding to the line endpoints, but are suc- cessively "squeezed down" by intersecting with the boundary lines. CS necessitates computing intersection points
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

2d-line-cliiping - A n/p (NisualIter Introduction C lipping...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online