Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition

Preview:

DESCRIPTION

Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition. Chapter 14. Figure 14.1: (a) A clipping rectangle R and four straight line segments with their parts clipped to R colored (b) Nine regions of the plane by outcode. - PowerPoint PPT Presentation

Citation preview

Computer Graphics Through OpenGL: From Theory to

Experiments, Second Edition

Chapter 14

Figure 14.1: (a) A clipping rectangle R and four straight line segments with their partsclipped to R colored (b) Nine regions of the plane by outcode.

Figure 14.2: Cohen-Sutherland, called on segment p1p2, recursively calls itself on p2q1,q1q2 and q2q3, successively.

Figure 14.3: Clipping a semi-infinite segment to a rectangle.

Figure 14.4: Clipping aline segment to anaxis-aligned box.

Figure 14.5: Cohen-Sutherland intersection computation.

Figure 14.6: A pipeline of clippers.

Figure 14.7: The left clipper in action: input = {v0, v1, v2, v3}, output ={v0, v1, v2, w, w’}.

Figure 14.8: Output of a pair of successive vertices (equivalently, edge) entering the leftclipper. Note both in-out and out-in dispositions have a special case, labeled (ii), wherethe vertex on the inside actually lies on L.

Figure 14.9: Applying the clipping rules.

Figure 14.10: The right clipper consumes the first two vertices v1 and v2 entering intoit from the left clipper to output w’’ and v2.

Figure 14.11: An m x n raster of pixels and a rasterized straight line segment.

Figure 14.12: Screenshotof DDA.cpp.

Figure 14.13: The larger circles are pixel centers. (a) Pixel (i, j) shown filled blue hasjust been chosen, the two candidate pixels for the next step are filled orange (b) Diagramfor Example 14.3.

Figure 14.14: Discrim-inating the position of apoint with respect to asegment: S is bold, whilethe straight line through itis thin.

Figure 14.15: Intersections of R with the boundary of P are labeled with theirrespective ranks.

Figure 14.16: Testing parity: the points p3 and p4 require handling a singularity.

Figure 14.17: Applying the parity test: the integer label beneath a segment of Rindicates the number of intersections of R with the boundary of P prior to reaching thatsegment. The reason for the change from 5 to 7 after p6 and from 9 to 11 after edge w’ isexplained in the text. The edges w and w’ are not labeled because they lie on theboundary.

Figure 14.18: The scan line as a ray with parities along segments indicated. Pixels fillthe polygon according to the parity test: pixels in the polygon are drawn solid, others arehollow.

Figure 14.19: Abuttingpolygons.

Figure 14.20: The non-horizontal edges of P are labeled left or right, while thehorizontal ones top or bottom. P owns the part of the boundary it shares with Q; P doesnot own the part of the boundary it shares with Q’.

Figure 14.21: Problems with Version 1.

Figure 14.22: Counting intersections according to Version 2: shown are eight scan lines,their intersections with the polygon boundary and the number of times each intersectionpoint appears in the sorted list for that scan line, according to statements 1 and 2 ofalgorithm Version 2. Polygon vertices and intersection points are not named to avoidclutter.

Figure 14.23: Edgecoherence.

Figure 14.24: The AEL values for scan lines 0, 4 and 5 for a polygon P in a 19 x 11raster. Pixels are drawn as hollow circles only for these three scan lines.

Figure 14.25: Edge table for the polygon P of Figure 14.24.

Figure 14.26: (a) Typ-ical dispositions of a leftand right edge with respectto a run of pixels (b) Theone exceptional case wherea left and a right edgemeet at a common lowerendpoint.

Figure 14.27: Flood-fill: (a) Initially (b) Fill pixels 4-adjacent to p (c) Fill pixels4-adjacent to the ones filled in the previous step. The starred pixel of (b) is examined byboth its south and west neighbors at this step.

Figure 14.28: Flood-fillfails on the polygon Qwhose boundary is drawn.

Recommended