Chapter 3. Sukhwinder Singh

Similar documents
Graphics (Output) Primitives. Chapters 3 & 4

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Polygon Filling. Can write frame buffer one word at time rather than one bit. 2/3/2000 CS 4/57101 Lecture 6 1

Unit 2 Output Primitives and their Attributes

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line

Chapter - 2: Geometry and Line Generations

(Refer Slide Time: 00:02:00)

UNIT 2 GRAPHIC PRIMITIVES

CSCI 4620/8626. Coordinate Reference Frames

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

Chapter 8: Implementation- Clipping and Rasterization

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

HS Geometry Mathematics CC

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Glossary of dictionary terms in the AP geometry units

Prime Time (Factors and Multiples)

Unit 5: Transformations in the Coordinate Plane

Rasterization: Geometric Primitives

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

4.5 VISIBLE SURFACE DETECTION METHODES

UNIT 1: TRANSFORMATIONS IN THE COORDINATE PLANE

Einführung in Visual Computing

Course Number: Course Title: Geometry

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

Mathematics High School Geometry An understanding of the attributes and relationships of geometric objects can be applied in diverse contexts

Mathematics Standards for High School Geometry

COMP371 COMPUTER GRAPHICS

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

Geometry Rules. Triangles:

Attributes of Graphics Primitives

Elementary Planar Geometry

NAEP Released Items Aligned to the Iowa Core: Geometry

GEOMETRY CURRICULUM MAP

8. Hidden Surface Elimination

Agenda. Polygon Terminology Types of polygons Inside Test Polygon Filling Algorithms. Scan-Line Polygon Fill Algorithm Flood-Fill Algorithm

CSC Computer Graphics

Mathematics High School Geometry

Overview of Computer Graphics

3 Identify shapes as two-dimensional (lying in a plane, flat ) or three-dimensional ( solid ).

Rasterization, or What is glbegin(gl_lines) really doing?

Topic #1: Rasterization (Scan Conversion)

Interactive Math Glossary Terms and Definitions

Common Core Specifications for Geometry

Learning Task: Exploring Reflections and Rotations

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

MET71 COMPUTER AIDED DESIGN

Log1 Contest Round 1 Theta Circles & Polygons. 4 points each. 5 points each

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Filled Area Primitives. CEng 477 Introduction to Computer Graphics METU, 2007

Geometry. Geometry. Domain Cluster Standard. Congruence (G CO)

CS 543: Computer Graphics. Rasterization

8. Hidden Surface Elimination

Pearson Mathematics Geometry Common Core 2015

CS6504 & Computer Graphics Unit I Page 1

Learning Task: Exploring Reflections and Rotations

Unit 1, Lesson 1: Moving in the Plane

UNIT 1 GEOMETRY TEMPLATE CREATED BY REGION 1 ESA UNIT 1

Moore Catholic High School Math Department

Graphics Output Primitives

Common Core Cluster. Experiment with transformations in the plane. Unpacking What does this standard mean that a student will know and be able to do?

Standards to Topics. Common Core State Standards 2010 Geometry

Unit 12 Topics in Analytic Geometry - Classwork

Geometry Common Core State Standard (CCSS) Math

From Ver(ces to Fragments: Rasteriza(on

Computer Graphics. - Rasterization - Philipp Slusallek

Honors Geometry Pacing Guide Honors Geometry Pacing First Nine Weeks

Geometry. Cluster: Experiment with transformations in the plane. G.CO.1 G.CO.2. Common Core Institute

Multivariable Calculus

CS 325 Computer Graphics

Geometry Vocabulary Math Fundamentals Reference Sheet Page 1

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Madison County Schools Suggested Geometry Pacing Guide,

Computer Graphics 7 - Rasterisation

Appendix. Correlation to the High School Geometry Standards of the Common Core State Standards for Mathematics

Ohio s Learning Standards-Extended. Mathematics. Congruence Standards Complexity a Complexity b Complexity c

Scan Conversion. Drawing Lines Drawing Circles

Curriki Geometry Glossary

High School Geometry. Correlation of the ALEKS course High School Geometry to the ACT College Readiness Standards for Mathematics

Unit 13: Periodic Functions and Trig

Geometry Vocabulary. acute angle-an angle measuring less than 90 degrees

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

8. The triangle is rotated around point D to create a new triangle. This looks like a rigid transformation.

State Standards. State Standards

Mathematics Geometry

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Two-Dimensional Viewing. Chapter 6

2003/2010 ACOS MATHEMATICS CONTENT CORRELATION GEOMETRY 2003 ACOS 2010 ACOS

Line Drawing. Foundations of Computer Graphics Torsten Möller

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Each point P in the xy-plane corresponds to an ordered pair (x, y) of real numbers called the coordinates of P.

Math Geometry FAIM 2015 Form 1-A [ ]

Russell County Pacing Guide

Introduction to Geometry

MADISON ACADEMY GEOMETRY PACING GUIDE

EOC Review: Practice: 1. In the circle below, AB = 2BC. What is the probability of hitting the shaded region with a random dart?

Transcription:

Chapter 3 Sukhwinder Singh

PIXEL ADDRESSING AND OBJECT GEOMETRY Object descriptions are given in a world reference frame, chosen to suit a particular application, and input world coordinates are ultimately converted to screen display positions. World descriptions of objects are given in terms of precise coordinate positions, which are infinitesimally small mathematical points. Pixel coordinates, however, reference finitescreen areas. To preserve the specified geometry of world objects,we need to compensate for the mapping of mathematical input points to finite pixel areas. 1. Adjust the dimensions of displayed objects to account for the amount of overlap of pixel areas with the object boundaries. 2. Map world coordinates onto screen positions between pixels, so that we align object boundaries with pixel boundaries instead of pixel centers.

Screen Grid Coordinates Addressing display positions in terms of pixel centers is to reference screen coordinates with respect to the grid of horizontal and vertical pixel boundary lines spaced one unit apart (Fig. 1(a) below). A screen coordinate position is then the pair of integer values identifying a grid intersection position between two pixels.

Screen Grid Coordinates For example, the mathematical line path for a polylinewith screen endpoints (0, 0), (5,2), and (1,4) is shown in Fig. 1b.

Screen Grid Coordinates With the coordinate origin at the lower left of the screen, each pixel area can be referenced by the integer grid coordinates of its lower left corner. Fig. 1c illustrates this convention for an 8 by 8 section of a raster, with a single illuminated pixel at screen coordinate position (4, 5). The area occupied by a pixel with screen coordinates (x, y) is identified as the unit square with diagonally opposite corners at (x, y) and (x+1,y+1).

Screen Grid Coordinates Advantages of this pixel-addressing scheme are: It avoids half-integer pixel boundaries, it facilitates precise object representations, and it simplifies the processing involved in many scanconversion algorithms and in other raster procedures.

Maintaining Geometric Properties of Displayed Objects To convert geometric descriptions of objects into pixel representations, Transformation of mathematical points and lines into finite screen areas is required. To maintain the original geometric measurements specified by the input coordinates for an object Take into account for the finite size of pixels when transformation of the object definition to a screen display is done.

Maintaining Geometric Properties of Displayed Objects Figure 2 shows the line plotted in the Bresenhamline-algorithm example. Interpreting the line endpoints (20, 10) and (30,18) as precise grid crossing positions, we see that the line should not extend past screen grid position (30, 18). If we were to plot the pixel with screen coordinates (30,18), as in the example, we would display a line that spans 11 horizontal units and 9 vertical units.

Maintaining Geometric Properties of Displayed Objects For the mathematical line, however, dx= 10 and dy= 8. If we are addressing pixels by their center positions, we can adjust the length of the displayed line by omitting one of the endpoint pixels. If we think of scan coordinates as addressing pixel boundaries, as shown in Fig. 2, we plot a line using only those pixels that are "interior" to the line path; that is only those pixels that are between the line endpoints. For this example, we would plot the leftmost pixel at (20, 10)and the rightmost pixel at (29,17). This displays a line that has the same geometric magnitudes as the mathematical line from (20, 10)to (30, 18).

Maintaining Geometric Properties of Displayed Objects For an enclosed area, Input geometric properties are maintained by displaying the area only with those pixels that are interior to the object boundaries. The rectangledefined with the screen coordinate vertices shown in Fig. 3(a), for example, is larger when we display it filled with pixels up to and including the border pixel lines joining the specified vertices. As defined, the area of the rectangle is 12 units, but as displayed in Fig. 3(b), it has an area of 20 units.

Maintaining Geometric Properties of Displayed Objects In Fig. 3(c), the original rectangle measurements are maintained by displaying only the internal pixels. The right boundary of the input rectangle is at x = 4. To maintain this boundary in the display, we set the rightmost pixel grid coordinate at x = 3. The pixels in this vertical column then span the interval from x = 3 to x =4. Similarly, the mathematical top boundary of the rectangle is at y = 3, so we set the top pixel row for the displayed rectangle at y = 2.

Maintaining Geometric Properties of Displayed Objects Other polygons and Curved figures A circle of radius 5 and center position (10, 10), for instance, would be displayed as in Fig. 4(a)by the midpoint circle algorithm using screen grid coordinate positions. But the plotted circle has a diameter of 11. To plot the circle with the defined diameter of 10, we can modify the circle algorithm to shorten each pixel scan line and each pixel column, as in Fig. 4 b. One way to do this is to generate points clockwise along the circular arc in the third quadrant, starting at screen coordinates (10, 5). For each generated point, the other seven circle symmetry points are generated by decreasing the x coordinate values by 1 along scan lines and decreasing the y coordinate values by 1 along pixel columns. Similar methods are applied in ellipse algorithms to maintain the specified proportions in the display of an ellipse.

Fig 4

FILLED-AREA PRIMITIVES There are two basic approaches to area filling on raster systems. One way to fill an area is to determine the overlap intervals for scan lines that cross the area. Another method for area filling is to start from a given interior position and paint outward from this point until we encounter the specified boundary conditions. The scan-line approach is typically used in general graphics packages to fill polygons, circles, ellipses, and other simple curves. All methods starting from an interior point are useful with more complex boundaries and in interactive painting systems.

Scan-Line Polygon Fill Algorithm For each scan line crossing a polygon, the area-fill algorithm locates the intersection points of the scan line with the polygon edges. These intersection points are then sorted from left to right, and the corresponding frame-buffer positions between each intersection pair are set to the specified fill color. Figure 5 illustrates the scan-line procedure for solid filling of polygon areas. Here, the four pixel intersection positions with the polygon boundaries define two stretches of interior pixels from x = 10 to x = 14 and from x = 18 to x = 24.

Scan-Line Polygon Fill Algorithm Some scan-line intersections at polygon vertices require special handling. A scan line passing through a vertex intersects two edges at that position, adding two points to the list of intersections for the scan line. Figure 6 shows two scan lines at positions y and y' that intersect edge endpoints. Scan line y intersects five polygon edges. Scan line y', however, intersects an even number of edges although it also passes through a vertex.

Scan-Line Polygon Fill Algorithm Intersection points along scan line y' correctly identify the interior pixel spans. But with scan line y, we need to do some additional processing to determine the correct interior points. The topological difference between scan line y and scan line y' in Fig. 6 is identified by noting the position of the intersecting edges relative to the scan line. For scan line y, the two intersecting edges sharing a vertex are on opposite sides of the scan line. For scan line y', the two intersecting edges are both above the scan line. Thus, the vertices that require additional processing are those that have connecting edges on opposite sides of the scan line.

Scan-Line Polygon Fill Algorithm These vertices can be identified by tracing around the polygon boundary either in clockwise or counterclockwise order and observing the relative changes in vertex y coordinates as we move from one edge to the next. If the endpoint y values of two consecutive edges monotonically increase or decrease, the middle vertex is counted as a single intersection point for any scan line passing through that vertex. Else, the shared vertex represents a local extremum (minimum or maximum) on the polygon boundary, the two edge intersections with the scan line passing through that vertex can be added to the intersection list.

Scan-Line Polygon Fill Algorithm One way to resolve the question as to whether we should count a vertex as one intersection or two is to shorten some polygon edges to split those vertices that should be counted as one intersection. Process nonhorizontaledges around the polygon boundary in the order specified, either clockwise or counterclockwise. Check to determine whether that edge and the next nonhorizontaledge have either monotonically increasing or decreasing endpoint y values. If so, the lower edge can be shortened to ensure that only one intersection point is generated for the scan line going through the common vertex joining the two edges. Figure 7 illustrates shortening of an edge. When the endpoint y coordinates of the two edges are increasing, the y value of the upper endpoint for the current edge isdecreased by 1, as in Fig. 7(a). When the endpoint y values are monotonically decreasing, as in Fig.7(b), we decrease the y coordinate of the upper endpoint of the edge following the current edge.

Scan-Line Polygon Fill Algorithm Calculations performed in scan-conversion and other graphics algorithms typically take advantage of various coherence properties of a scene that is to be displayed. What we mean by coherence is simply that the properties of one part of a scene are related in some way to other parts of the scene so that the relationship can be used to reduce processing. Coherence methods often involve incremental calculations applied along a single scan line or between successive scan lines. In determining edge intersections, we can set up incremental coordinate calculations along any edge by exploiting the fact that the slope of the edge is constant from one scan line to the next. Figure 8 shows two successive scan lines crossing a left edge of a polygon. The slope of this polygon boundary line can be expressed in terms of the scan-line intersection coordinates:

Fig 8

Scan-Line Polygon Fill Algorithm To efficiently perform a polygon fill, wt can first store the polygon boundary in a sorted edge table that contains all the information necessary to process the scan lines efficiently. Proceeding around the edges in either a clockwise or a counterclockwise order, we can use a bucket sort to store the edges, sorted on the smallest y value of each edge, in the correct scan-he positions. Only nonhorizontal edges are entered into the sorted edge table. As the edges are processed, we can also shorten certain edges to resolve the vertex-intersection question. Each entry in the table for a particular scan line contains that maximum y value for that edge, the x-intercept value (at the lower vertex) for the edge, and the inverse slope of the edge. For each scan line, the edges are in sorted order from left to right. Fig 9 shows a polygon and the associated sorted edge table.

Fig 9

Scan-Line Polygon Fill Algorithm Next, we process the scan lines from the bottom of the polygon to its top,producing an active edge listfor each scan line crossing the polygon boundaries. The active edge list for a scan line contains all edges crossed by that scan line, with iterative coherence calculations used to obtain the edge intersections. Implementation of edge-intersection calculations tan also be facilitated by storing Δx and Δyvalues in the sorted edge table. Also, to ensure that we correctly fill the interior of specified polygons, we can apply the considerations discussed in Section 3-10. For each scan line, we fill in the pixel spans for each pair of x- intercepts starting from the leftmost x-intercept value and ending at one position before the rightmost x intercept. And each polygon edge can be shortened by one unit in they direction at the top endpoint. These measures also guarantee that pixels in adjacent polygons will not overlap each other.