Computer graphics through opengl from theory to experiments second edition
This presentation is the property of its rightful owner.
Sponsored Links
1 / 29

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


  • 64 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

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

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Computer graphics through opengl from theory to experiments second edition

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

Chapter 14


Computer graphics through opengl from theory to experiments second edition

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.


Computer graphics through opengl from theory to experiments second edition

Figure 14.2: Cohen-Sutherland, called on segment p1p2, recursively calls itself on p2q1,

q1q2 and q2q3, successively.


Computer graphics through opengl from theory to experiments second edition

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


Computer graphics through opengl from theory to experiments second edition

Figure 14.4: Clipping a

line segment to an

axis-aligned box.


Computer graphics through opengl from theory to experiments second edition

Figure 14.5: Cohen-Sutherland intersection computation.


Computer graphics through opengl from theory to experiments second edition

Figure 14.6: A pipeline of clippers.


Computer graphics through opengl from theory to experiments second edition

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

{v0, v1, v2, w, w’}.


Computer graphics through opengl from theory to experiments second edition

Figure 14.8: Output of a pair of successive vertices (equivalently, edge) entering the left

clipper. Note both in-out and out-in dispositions have a special case, labeled (ii), where

the vertex on the inside actually lies on L.


Computer graphics through opengl from theory to experiments second edition

Figure 14.9: Applying the clipping rules.


Computer graphics through opengl from theory to experiments second edition

Figure 14.10: The right clipper consumes the first two vertices v1 and v2 entering into

it from the left clipper to output w’’ and v2.


Computer graphics through opengl from theory to experiments second edition

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


Computer graphics through opengl from theory to experiments second edition

Figure 14.12: Screenshot

of DDA.cpp.


Computer graphics through opengl from theory to experiments second edition

Figure 14.13: The larger circles are pixel centers. (a) Pixel (i, j) shown filled blue has

just been chosen, the two candidate pixels for the next step are filled orange (b) Diagram

for Example 14.3.


Computer graphics through opengl from theory to experiments second edition

Figure 14.14: Discrim-

inating the position of a

point with respect to a

segment: S is bold, while

the straight line through it

is thin.


Computer graphics through opengl from theory to experiments second edition

Figure 14.15: Intersections of R with the boundary of P are labeled with their

respective ranks.


Computer graphics through opengl from theory to experiments second edition

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


Computer graphics through opengl from theory to experiments second edition

Figure 14.17: Applying the parity test: the integer label beneath a segment of R

indicates the number of intersections of R with the boundary of P prior to reaching that

segment. The reason for the change from 5 to 7 after p6 and from 9 to 11 after edge w’ is

explained in the text. The edges w and w’ are not labeled because they lie on the

boundary.


Computer graphics through opengl from theory to experiments second edition

Figure 14.18: The scan line as a ray with parities along segments indicated. Pixels fill

the polygon according to the parity test: pixels in the polygon are drawn solid, others are

hollow.


Computer graphics through opengl from theory to experiments second edition

Figure 14.19: Abutting

polygons.


Computer graphics through opengl from theory to experiments second edition

Figure 14.20: The non-horizontal edges of P are labeled left or right, while the

horizontal ones top or bottom. P owns the part of the boundary it shares with Q; P does

not own the part of the boundary it shares with Q’.


Computer graphics through opengl from theory to experiments second edition

Figure 14.21: Problems with Version 1.


Computer graphics through opengl from theory to experiments second edition

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 intersection

point appears in the sorted list for that scan line, according to statements 1 and 2 of

algorithm Version 2. Polygon vertices and intersection points are not named to avoid

clutter.


Computer graphics through opengl from theory to experiments second edition

Figure 14.23: Edge

coherence.


Computer graphics through opengl from theory to experiments second edition

Figure 14.24: The AEL values for scan lines 0, 4 and 5 for a polygon P in a 19 x 11

raster. Pixels are drawn as hollow circles only for these three scan lines.


Computer graphics through opengl from theory to experiments second edition

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


Computer graphics through opengl from theory to experiments second edition

Figure 14.26: (a) Typ-

ical dispositions of a left

and right edge with respect

to a run of pixels (b) The

one exceptional case where

a left and a right edge

meet at a common lower

endpoint.


Computer graphics through opengl from theory to experiments second edition

Figure 14.27: Flood-fill: (a) Initially (b) Fill pixels 4-adjacent to p (c) Fill pixels

4-adjacent to the ones filled in the previous step. The starred pixel of (b) is examined by

both its south and west neighbors at this step.


Computer graphics through opengl from theory to experiments second edition

Figure 14.28: Flood-fill

fails on the polygon Q

whose boundary is drawn.


  • Login