Prof. Harriet Fell Spring 2007 Lecture 9 – January 29, 2007

Slides:



Advertisements
Similar presentations
Polygon Scan Conversion – 11b
Advertisements

SI23 Introduction to Computer Graphics
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 7 Scanline algorithm and polygon clipping Taku Komura.
Project-Impact/CSE/IITB/93 CG/Mod-2/SC/1 Basic Raster Graphics "Trifles make perfection, but perfection is no trifle" Michael Angelo ++ Topics Scan conversion.
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
Polygon Rasterization
College of Computer and Information Science, Northeastern UniversityApril 17, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 9.
Convex Hull obstacle start end Convex Hull Convex Hull
Different types of Polygons Simple Convex Simple Concave Non-simple : self-intersecting With holes ConvexConcaveSelf-intersecting.
CPCS 391 Computer Graphics 1 Lecture 5: Polygon Filling
CSCE 441: Computer Graphics Scan Conversion of Polygons
Graphics Programming: Polygon Filling
CS 248 Assignment 2 Polygon Scan Converter CS248 Presented by Abe Davis Stanford University October 17, 2008.
College of Computer and Information Science, Northeastern UniversityJune 21, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 21.
TOPIC 4 PART III FILL AREA PRIMITIVES POLYGON FILL AREAS CGMB214: Introduction to Computer Graphics.
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Polygon Scan Conversion and Z-Buffering
Frequency Distributions, Histograms, and Related Topics.
College of Computer and Information Science, Northeastern UniversitySeptember 12, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture.
CS 445 / 645 Introduction to Computer Graphics Lecture 8 Triangle Rasterization Lecture 8 Triangle Rasterization.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
College of Computer and Information Science, Northeastern UniversityOctober 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
College of Computer and Information Science, Northeastern UniversityMay 27, CS 4300 Computer Graphics Prof. Harriet Fell Fall 2012 Lecture 9 – September.
Scan Conversion. Last step in the graphics pipeline Efficiency is a central issue Common primitives – Lines (done last class) – Polygons (fill polygons,
College of Computer and Information Science, Northeastern UniversityOctober 31, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2009.
CS 325 Introduction to Computer Graphics 03 / 22 / 2010 Instructor: Michael Eckmann.
Copyright  1999 by James H. Money. All rights reserved. Except as permitted under United States Copyright Act of 1976, no part of this publication may.
Computing & Information Sciences Kansas State University CIS 536/636 Introduction to Computer Graphics Lecture 8 of 41 William H. Hsu Department of Computing.
Introduction to Computer Graphics CS 445 / 645 Lecture 9 Chapter 4: Rasterization L. McMillan MIT notes (Fall ’98)
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
Computer Graphics Filling. Filling Polygons So we can figure out how to draw lines and circles How do we go about drawing polygons? We use an incremental.
Lecture 15: Raster Graphics and Scan Conversion
1 CSCE 441: Computer Graphics Scan Conversion of Polygons Jinxiang Chai.
Kansas State University Department of Computing and Information Sciences CIS 736: Computer Graphics Friday, January 21, 2000 William H. Hsu Department.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 14.
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
CS552: Computer Graphics Lecture 16: Polygon Filling.
Computer Graphics Filling.
Introduction to Polygons
CS G140 Graduate Computer Graphics
(c) 2002 University of Wisconsin, CS559
Basic Raster Graphics Algorithms for Drawing 2D Primitives
Computer Graphics Filled Area Primitives II Lecture 09 Taqdees A
Prof. Harriet Fell Spring 2007 Lecture 5 – January 17, 2006
Polygon Filling Algorithms
Zhen Jiang West Chester University
Computer Graphics Filling & Color.
Agenda Polygon Terminology Types of polygons Inside Test
Punya Biswas Lecture 15 Closest Pair, Multiplication
CS G140 Graduate Computer Graphics
Prepared by Narendra V G CSE MIT
Agenda Polygon Terminology Types of polygons Inside Test
Richard Anderson Lecture 13 Divide and Conquer
Prof. Harriet Fell Fall 2011 Lecture 9 – September 26, 2011
Prof. Harriet Fell Spring 2006 Lecture 21 – February 28,2007
(c) 2002 University of Wisconsin, CS559
Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Rasterizing Polygons Lecture 29 Wed, Dec 7, 2005.
Computer Science 2 More Trees.
Basic Raster Graphics Algorithms for Drawing 2D Primitives
NOTE.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Where We Stand At this point we know how to: Next thing:
Type to enter a caption. Computer Graphics Week 6 Lecture 1.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Richard Anderson Lecture 13 Divide and Conquer
Presentation transcript:

Prof. Harriet Fell Spring 2007 Lecture 9 – January 29, 2007 CS U540 Computer Graphics Prof. Harriet Fell Spring 2007 Lecture 9 – January 29, 2007 November 14, 2018

Today’s Topics Fill: Boundary Fill vs. Polygon Fill 2D Polygon Fill November 14, 2018

Scan Line Polygon Fill November 14, 2018

Parity Check Draw a horizontal half-line from P to the right. Count the number of times the half-line crosses an edge. 1 in 4 out 7 in 7 in November 14, 2018

Polygon Data Structure edges xmin ymax 1/m  (9, 6) 1 6 8/4  xmin = x value at lowest y ymax = highest y Why 1/m? (1, 2) If y = mx + b, x = (y-b)/m. x at y+1 = (y+1-b)/m = (y-b)/m + 1/m. November 14, 2018

Polygon Data Structure 13 12 11 10  e6 9 8 7  e4  e5 6  e3  e7  e8 5 4 3 2 1  e2  e1  e11 0  e10  e9 Edge Table (ET) has a list of edges for each scan line. 13 e6 10 e5 e3 e7 e4 e8 5 e9 e2 e11 e10 e1

Preprocessing the edges For a closed polygon, there should be an even number of crossings at each scan line. We fill between each successive pair. count twice, once for each edge delete horizontal edges chop lowest pixel to only count once November 14, 2018

Polygon Data Structure after preprocessing 13 12 11 10  e6 9 8 7  e4  e5 6  e3  e7  e8 5 4 3 2 1  e2  e1  e11 0  e10  e9 11  e6 10 Edge Table (ET) has a list of edges for each scan line. 13 7  e3  e4  e5 6  e7  e8 e6 10 e5 e3 e7 e4 e8 5 e9 e2 e11 e11 e10 e1

The Algorithm Start with smallest nonempty y value in ET. Initialize SLB (Scan Line Bucket) to nil. While current y  top y value: Merge y bucket from ET into SLB; sort on xmin. Fill pixels between rounded pairs of x values in SLB. Remove edges from SLB whose ytop = current y. Increment xmin by 1/m for edges in SLB. Increment y by 1. November 14, 2018

Running the Algorithm ET e6 e5 e3 e7 e4 e8 e9 e2 e11 e10 11  e6 13 12 11  e6 10 9 8 7  e3  e4  e5 6  e7  e8 5 4 3 2 1  e2  e11 0  e10  e9 xmin ymax 1/m e2 2 6 -2/5 e3 1/3 12 1/3 e4 4 12 -2/5 e5 4 13 0 e6 6 2/3 13 -4/3 e7 10 10 -1/2 e8 10 8 2 e9 11 8 3/8 e10 11 4 -3/4 e11 6 4 2/3 Running the Algorithm 13 e6 10 e5 e3 e7 e4 e8 5 e9 e2 e11 e10 5 10 15

Running the Algorithm y=0 SCB e10 e6 11 10 1/4 4 -3/4  e5 e3 e7 e9 13 e6 11 10 1/4 4 -3/4  10 e5 e3 e7 e9 e4 e8 11 3/8 11 8 3/8  5 e9 e2 e11 e10 5 10 15 November 14, 2018

Running the Algorithm y=1 SLB e2 e6 2 1 3/5 6 -2/5  e5 e3 e7 e11 e4 13 e6 2 1 3/5 6 -2/5  10 e5 e3 e7 e11 e4 e8 6 6 2/3 4 2/3  5 e9 e10 e2 e11 9 1/2 10 1/4 4 -3/4  e10 e9 5 10 15 11 6/8 11 3/8 8 3/8  November 14, 2018

Running the Algorithm y=2 SLB e2 e6 1 3/5 1 1/5 6 -2/5  e5 e3 e7 e11 13 e6 1 3/5 1 1/5 6 -2/5  10 e5 e3 e7 e11 e4 e8 6 2/3 7 1/3 4 2/3  5 e9 e10 e2 e11 9 1/2 8 3/4 4 -3/4  e10 e9 5 10 15 11 6/8 12 1/8 8 3/8  November 14, 2018

Running the Algorithm y=3 SLB e2 e6 4/5 1 1/5 6 -2/5  e5 e3 e7 e11 13 e6 4/5 1 1/5 6 -2/5  10 e5 e3 e7 e11 e4 e8 7 1/3 8 4 2/3  5 e9 e10 e2 e11 8 8 3/4 4 -3/4  e10 e9 5 10 15 12 1/8 12 4/8 8 3/8  November 14, 2018

Running the Algorithm y=4 SLB e2 e6 4/5 6 -2/5  e5 e3 e7 e11 e4 e8 8 13 e6 4/5 6 -2/5  10 e5 e3 e7 e11 e4 e8 8 4 2/3  5 e9 e10 e2 e11 8 4 -3/4  e10 e9 5 10 15 12 4/8 8 3/8  Remove these edges. November 14, 2018

Running the Algorithm y=4 SLB e2 e6 2/5 4/5 6 -2/5  e5 e3 e7 e9 e4 13 e6 2/5 4/5 6 -2/5  10 e5 e3 e7 e9 e4 e8 12 7/8 12 4/8 8 3/8  5 e9 e11 and e10 are removed. e2 e11 e10 5 10 15 November 14, 2018

Running the Algorithm y=5 SLB e2 e6 2/5 6 -2/5  e5 e3 e7 e9 e4 e8 13 e6 2/5 6 -2/5  10 e5 e3 e7 e9 e4 e8 13 2/8 12 7/8 8 3/8  5 e9 e2 e11 e10 5 10 15 November 14, 2018

Running the Algorithm Remove this edge. y=6 SLB e2 e6 6 -2/5  e5 e3 13 e6 6 -2/5  10 e5 e3 e7 e7 e4 e8 10 9 1/2 10 -1/2  5 e9 e8 e2 e11 10 12 8 2  e10 e9 5 10 15 13 2/8 13 5/8 8 3/8  November 14, 2018

Running the Algorithm Add these edges. e3 1/3 12 1/3  e4 4 12 -2/5  13 e6 e5 10 e5 4 13  e3 e7 e4 e8 y=7 SLB e7 5 9 1/2 10 -1/2  e9 e2 e11 e8 e10 12 8 2  5 10 15 e9 13 5/8 8 3/8 