1 / 29

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

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.

Télécharger la présentation

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 14

  2. 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.

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

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

  5. Figure 14.4: Clipping a line segment to an axis-aligned box.

  6. Figure 14.5: Cohen-Sutherland intersection computation.

  7. Figure 14.6: A pipeline of clippers.

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

  9. 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.

  10. Figure 14.9: Applying the clipping rules.

  11. 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.

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

  13. Figure 14.12: Screenshot of DDA.cpp.

  14. 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.

  15. 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.

  16. Figure 14.15: Intersections of R with the boundary of P are labeled with their respective ranks.

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

  18. 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.

  19. 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.

  20. Figure 14.19: Abutting polygons.

  21. 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’.

  22. Figure 14.21: Problems with Version 1.

  23. 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.

  24. Figure 14.23: Edge coherence.

  25. 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.

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

  27. 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.

  28. 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.

  29. Figure 14.28: Flood-fill fails on the polygon Q whose boundary is drawn.

More Related