CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE

Size: px
Start display at page:

Download "CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE"

Transcription

1 CS 45: COMPUTER GRAPHICS RASTERIZING LINES SPRING 6 DR. MICHAEL J. REALE

2 OBJECT-ORDER RENDERING We going to start on how we will perform object-order rendering Object-order rendering Go through each OBJECT find out what piels are affected Advantages: Much more efficient for large scenes with lots of objects although how ou access data will mae this more or less efficient Also called rendering b rasterization or scanline renderering

3 RASTERIZATION Rasterization = finding all piels in an image that are occupied b a geometric primitive Also called scan conversion Eample: have nice, continuous formula for a line pic reasonable piels discrete positions to fill in to represent line, f

4 GRAPHICS PIPELINE Graphics pipeline We ve got this and we want this Generates or renders a D image given a 3D scene of objects I.e., whole sequence of operations that taes us from 3D OBJECTS PIXELS IN IMAGE Also called graphics rendering pipeline or just the pipeline Composed of both hardware and software We ll tal about the other steps in the pipeline in more detail later For now, let s assume that we have D representations of the primitives we want to draw lines, circles, triangles, etc. Basicall woring in screen space Picing the right piels job of the rasterization stage

5 RASTERIZATION STAGE Rasterization stage Enumerates piels covered b primitive Interpolates values called attributes across the primitive Color would be an attribute Outputs fragments One fragment for each piel covered b primitive Each fragment lives at a particular piel Each fragment has its own set of attribute values Fragments then need to be processed and possibl blended to get each piel s final color E.g., given two fragments from different objects but in the same location which one do ou draw? Do ou blend them together? Some include the fragment processing and blending stages as part of the rasterization stage

6 RASTERIZING LINES OVERVIEW

7 A POINT OF CLARITY In this case, we are taling about drawing/rasterizing line segments That is, the lines have a defined beginning point and end point

8 RASTERIZING LINES OVERVIEW To rasterize lines, we ll discuss several algorithms: DDA Digital differential analzer Midpoint Bresenham

9 A NOTE ABOUT EFFICIENCY As we discuss these algorithms, we will tal about their relative efficienc HOWEVER, hardware has changed what is most efficient has changed Still true: Should do fewer operations if ou can Multipl/divide more comple than add/subtract USED to be true: Integer calculations were much faster than floating-point operations on older hardware Bresenham most efficient in this respect because it onl uses integers However, modern hardware doesn t reall have this problem anmore End of the da: need to actual profile our code on our hardware to see where the bottlenecs are

10 DDA LINE DRAWING ALGORITHM

11 SLOPE-INTERCEPT FORM As we ve seen before, a straight line can be mathematicall defined using the Cartesian slope-intercept equation: m We re dealing with line segments, so these have specified starting and ending points: So, we can compute the slope m and the intercept b as follows: m b end end m b, end, end

12 INTERVALS Let s sa we have: change change in in interval interval in in "run" "rise" That means we can get δ from the slope m and δ: rise m* * run run rise Similarl, we can get δ from δ: m

13 DDA ALGORITHM Digital differential analzer DDA Scan-conversion line algorithm based on calculating either δ or δ Sample one coordinate at unit intervals find nearest integer value for other coordinate Eample: < m <=. slope positive, with δ > δ Increment in unit intervals δ = Compute successive values as follows: Round value to nearest integer m

14 DDA ALGORITHM: M >. Problem: If slope is positive AND greater than. m >., then we increment b sip piels in! Solution: swap roles of and! Increment in unit intervals δ = Compute successive values as follows: Round value to nearest integer m

15 DDA ALGORITHM: WHICH DO WE STEP IN? So, to summarize so far, which coordinate should be increment? Remember: If absδ > absδ: Step in X Otherwise: Step in Y m end end

16 DDA ALGORITHM: LINES IN REVERSE We ve been assuming that the ending point has a coordinate value greater than the starting point: Left to right, if incrementing Bottom to top, if incrementing However, we could be going in reverse. If so, then: If right to left, δ = - If top to bottom, δ = - Right-to-left Top-to-bottom

17 DDA ALGORITHM: CODE // Get d and d int d = - ; int d = - ; int steps, ; float Increment, Increment; // Set starting point float = ; float = ;

18 DDA ALGORITHM: CODE // Determine which coordinate we should step in if absd > absd steps = absd; else steps = absd; // Compute increments Increment = floatd / floatsteps; Increment = floatd / floatsteps;

19 DDA ALGORITHM: CODE // Let s assume we have a magic function called setpiel, that sets a piel at, to the appropriate color. // Set value of piel at starting point setpielround, round; // For each step for = ; < steps; ++ { // Increment both and += Increment; += Increment; } // Set piel to correct color // NOTE: we need to round off the values to integer locations setpielround, round;

20 DDA ALGORITHM: PROS AND CONS Advantage: Faster than using the slope-intercept form directl no multiplication, onl addition Caveat: initial division necessar to get increments Wors for lines in all directions b default Disadvantages: Accumulation of round-off error line can drift off true path Rounding procedure time-consuming

21 MIDPOINT ALGORITHM

22 MIDPOINT ALGORITHM DDA uses eplicit form Midpoint algorithm uses implicit form f, Avoids rounding Basic idea: test whether the point f+, + ½ is inside or outside choose closest point Can be etended to other inds of curves beond lines We ll tal about some of these later

23 CHOOSING THE NEXT PIXEL For starters, let s assume our slope m is, ] We ll tal about the other three cases later Thus, we re incrementing in Basicall, if we ve plotted a piel,, we need to choose between: +, +, + Question: which one is closer to the true line?

24 CHOOSE WISELY Pseudocode-wise, this becomes: = For = to draw, if some condition: = + So, what is some condition?

25 THE MIDPOINT PART f If we have an implicit equation for the line f,:, Then: f, > ABOVE line f, = ON line f, < BELOW line SO, we tae a loo at the midpoint between our two choices: f +, +.5 f +, +.5 > midpoint ABOVE line BOTTOM point closer choose +, f +, +.5 < midpoint BELOW line TOP point closer choose +, +

26 SOME CONDITION Thus, the pseudocode becomes: = For = to draw, if f+, +.5 < : = +

27 INCREMENTAL VERSION One problem: we are evaluating the function f, ever iteration We can mae an incremental version of the approach that will mae it more efficient Let s sa our net point is going to be, or,+ need to evaluate f, +.5 Observation: we must have evaluated ONE of the following in the previous iteration: f,.5 OR f, +.5 depending on whether we chose to increment last time or not

28 INCREMENTAL VERSION Two interesting things to note about our implicit line equation:,, f f,, f f

29 INCREMENTAL VERSION This means that, if we alread have f,, we can compute both f+, and f+,+ b adding on certain constant values: SO, that means, if we need f, +.5: DIDN T increment last time have f, +.5 DID increment last time have f,.5,,,, f f f f.5,.5, f f.5,.5, f f

30 INCREMENT VERSION: ADDITIONAL EFFICIENCY Can mae faster b precomputing and storing:.5,.5, f f.5,.5, f f

31 INCREMENTAL VERSION: CODE To eep trac of this, we have a decision variable d: = d = f +, +.5 For = to draw, if d < : = + d = d + + else d = d +

32 MIDPOINT ALGORITHM: PROS AND CONS Advantages: Lie DDA onl using addition in main loop UNLIKE DDA: No rounding No initial division needed Etendable to other inds of curves circles, ellipses, etc. Disadvantages: If lines are VERY long can accumulate floating point errors over time Decision variable = still floating-point number Usuall not a big problem in practice Still using floating point calculations slower on older hardware

33 BRESENHAM S ALGORITHM

34 INTRODUCTION The Midpoint algorithm still uses floating-point calculations for its decision variable Bresenham s algorithm uses all integers More efficient in das of ore Slightl more involved derivation Uses distances between candidate points and true line to mae decision

35 BRESENHAM S LINE ALGORITHM: THE IDEA We ll start b assuming the slope is, ] lie before Similar to midpoint loo at a decision variable to help us mae the choice at each step However, derivation of variable is different Our previous position:, d d lower upper distance distance of of,, from true line coordinate from true line coordinate,,

36 BRESENHAM S LINE ALGORITHM: MATH The value of for the mathematical line at + is given b: Ergo: b m b m d b m d upper lower

37 BRESENHAM S LINE ALGORITHM: MORE MATH To determine which of the two piels is closer to the true line path, we can loo at the sign of the following: Positive d upper is smaller choose + Negative d lower is smaller choose b m b m b m b m b m d d upper lower

38 BRESENHAM S LINE ALGORITHM: EVEN MORE MATH Remember that: Substituting with our current equation: We will let our decision variable p be the following m end end b d d upper lower c b b b b d d p upper lower

39 BRESENHAM S LINE ALGORITHM: DECISION VARIABLE p c Multipling b Δ won t affect the sign of p, since Δ > Note that constant c does not depend on the current position at all, so can compute it ahead of time: So, as before: c b p positive d upper is smaller choose + p negative d lower is smaller choose

40 BRESENHAM S LINE ALGORITHM: UPDATING P K We can get the net value of the decision variable i.e., p + using p c c c c p p c p c p

41 BRESENHAM S LINE ALGORITHM: UPDATING P K However, we now: Therefore: So, we need to determine what + was: If p was positive + = If p was negative + = p p p p p p

42 BRESENHAM S LINE ALGORITHM: SUMMARIZED. Input two line endpoints and store LEFT endpoint in, Allows us to deal with lines going in the OPPOSITE direction!. Plot first point, 3. Compute constants Δ, Δ, Δ, and Δ - Δ. Also compute first value of decision variable: p = Δ Δ 4. At each, test p : If p plot p plot p : Otherwise 5. Perform step 4 Δ times : p p,, NOTE: Effectivel assuming line starts at, and thus b = p b NOTE: This version ONLY wors with < m <.!!! Ergo, Δ and Δ are positive here!

43 COMPARISON TO MIDPOINT Bresenham s decision variable: Starting value: Increment if p > Increment cases: Incremented last time: Did NOT increment last time: p p p p p Bresenham: - Everthing multiplied b removes floating point - Decision variable and increments flipped Midpoint decision variable: Starting value: Increment if d < Increment cases: Incremented last time: Did NOT increment last time: f,.5 f, *.5 *.5 d d d d d

44 BRESENHAM S LINE ALGORITHM: CODE // NOTE: d and d are ABSOLUTE VALUES in this code int d = fabs - ; int d = fabs - ; int p = *d - d; int twod = *d; int twodminusd = *d - d; int,;

45 BRESENHAM S LINE ALGORITHM: CODE // Determine which endpoint to use as start position if > { = ; = ; = ; } else { = ; = ; } // Plot first piel setpiel,;

46 BRESENHAM S LINE ALGORITHM: CODE while < { ++; } ifp < p += twod; else { ++; p += twodminusd; } setpiel,;

47 DRAWING LINES IN ALL DIRECTIONS

48 DRAWING LINES IN ALL DIRECTIONS For Midpoint and Bresenham, we have thus far assumed slope m is within, ] Minor eception: our current version of Bresenham allows us to draw lines in reverse in, but the slope is still positive To draw lines in ALL directions, we ll have to emplo a few trics We will be discussing the trics with Bresenham in mind, but ou can use similar strategies for Midpoint as well

49 LINE DRAWING GENERALIZED Abschange in Y > abschange in X? Swap roles of X and Y Is X going in negative direction? Swap endpoints Set starting Y coordinate Is Y going in negative direction? Set Y increment to - Swap Y coordinates of endpoints Basic idea: We will start at the original Y and we will decrement Y as necessar. HOWEVER, we will PRETEND lie we are drawing a line that is going up decisions will be the same e.g., eep current Y, change Y Calculate first decision variable and decision variable increments

50

51 SPECIAL CASES IN LINE DRAWING To save time, if ou have a line that is: Δ = vertical Δ = horizontal Δ = Δ diagonal ou can just draw it directl without going through the entire algorithm.

52 ALGORITHM COMPARISON

53 ALGORITHM COMPARISON DDA Digital differential analzer Not ver efficient rounding Ver straightforward Can drift because of round-off error Midpoint Efficient No rounding, no initial division lie in DDA Mostl straightforward Uses minimal floating-point calculations Can drift, but onl for ver long lines Bresenham Efficient More involved to derive Uses all integers

CS 548: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

CS 548: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 548: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 05 DR. MICHAEL J. REALE OPENGL POINTS AND LINES OPENGL POINTS AND LINES In OenGL, there are different constants used to indicate what ind of rimitive

More information

CSC Computer Graphics

CSC Computer Graphics 7//7 CSC. Computer Graphics Lecture Kasun@dscs.sjp.ac.l Department of Computer Science Universit of Sri Jaewardanepura Line drawing algorithms DDA Midpoint (Bresenham s) Algorithm Circle drawing algorithms

More information

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete Scan Conversion CMP 477 Computer Graphics S. A. Areete What is Scan-Conversion? 2D or 3D objects in real world space are made up of graphic primitives such as points, lines, circles and filled polygons.

More information

GRAPHICS OUTPUT PRIMITIVES

GRAPHICS OUTPUT PRIMITIVES CHAPTER 3 GRAPHICS OUTPUT PRIMITIVES LINE DRAWING ALGORITHMS DDA Line Algorithm Bresenham Line Algorithm Midpoint Circle Algorithm Midpoint Ellipse Algorithm CG - Chapter-3 LINE DRAWING Line drawing is

More information

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE DRAWING PRIMITIVES: LEGACY VS. NEW Legacy: specify primitive in glbegin() glbegin(gl_points); glvertex3f(1,5,0);

More information

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007 OUTPUT PRIMITIVES CEng 477 Introduction to Computer Graphics METU, 007 Recap: The basic forward projection pipeline: MCS Model Model Modeling Transformations M M 3D World Scene Viewing Transformations

More information

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal Raster Displays and Scan Conversion Computer Graphics, CSCD18 Fall 28 Instructor: Leonid Sigal Rater Displays Screen is represented by 2D array of locations called piels y Rater Displays Screen is represented

More information

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

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Downloaded from :www.comp.dit.ie/bmacnamee/materials/graphics/006- Contents In today s lecture we ll have a loo at:

More information

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms Computer Graphics: Graphics Output Primitives Line Drawing Algorithms By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. Basic concept of lines in OpenGL 2. Line Equation 3. DDA Algorithm 4. DDA

More information

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Lecture 3 Graphics Output Primitives Somsa Walairacht, Computer Engineering, KMITL Outline Line Drawing Algorithms Circle-, Ellipse-Generating Algorithms Fill-Area Primitives Polgon Fill

More information

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

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

Line Drawing Week 6, Lecture 9

Line Drawing Week 6, Lecture 9 CS 536 Computer Graphics Line Drawing Week 6, Lecture 9 David Breen, William Regli and axim Peysakhov Department of Computer Science Drexel University Outline Line drawing Digital differential analyzer

More information

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons

Computer Graphics. Modelling in 2D. 2D primitives. Lines and Polylines. OpenGL polygon primitives. Special polygons Computer Graphics Modelling in D Lecture School of EECS Queen Mar, Universit of London D primitives Digital line algorithms Digital circle algorithms Polgon filling CG - p.hao@qmul.ac.uk D primitives Line

More information

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

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

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

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi Output Primitives Dr. S.M. Malaek Assistant: M. Younesi Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces,

More information

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

Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by: Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

Graphics Output Primitives

Graphics Output Primitives Important Graphics Output Primitives Graphics Output Primitives in 2D polgons, circles, ellipses & other curves piel arra operations in 3D triangles & other polgons Werner Purgathofer / Computergraphik

More information

CS335 Fall 2007 Graphics and Multimedia. 2D Drawings: Lines

CS335 Fall 2007 Graphics and Multimedia. 2D Drawings: Lines CS335 Fall 007 Grahics and Multimedia D Drawings: Lines Primitive Drawing Oerations Digital Concets of Drawing in Raster Arras PIXEL is a single arra element at x, - No smaller drawing unit exists Px,

More information

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

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

1 Introduction to Graphics

1 Introduction to Graphics 1 1.1 Raster Displays The screen is represented by a 2D array of locations called pixels. Zooming in on an image made up of pixels The convention in these notes will follow that of OpenGL, placing the

More information

Prof. Feng Liu. Fall /25/2018

Prof. Feng Liu. Fall /25/2018 Prof. Feng Liu Fall 08 http://www.cs.pd.edu/~fliu/courses/cs7/ 0/5/08 Last time Clipping Toda Rasterization In-class Mid-term November Close-book eam Notes on page of A or Letter size paper Where We Stand

More information

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Digital Differential Analyzer Bresenhams Line Drawing Algorithm Bresenham s Line Generation The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations. Difference Between

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center

12.4 The Ellipse. Standard Form of an Ellipse Centered at (0, 0) (0, b) (0, -b) center . The Ellipse The net one of our conic sections we would like to discuss is the ellipse. We will start b looking at the ellipse centered at the origin and then move it awa from the origin. Standard Form

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology

Intermediate Algebra. Gregg Waterman Oregon Institute of Technology Intermediate Algebra Gregg Waterman Oregon Institute of Technolog c 2017 Gregg Waterman This work is licensed under the Creative Commons Attribution 4.0 International license. The essence of the license

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

CS Rasterization. Junqiao Zhao 赵君峤

CS Rasterization. Junqiao Zhao 赵君峤 CS10101001 Rasterization Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Vector Graphics Algebraic equations describe

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,

More information

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care? Where does a picture come from? Rasterization and Graphics Hardware CS559 Course Notes Not for Projection November 2007, Mike Gleicher Result: image (raster) Input 2D/3D model of the world Rendering term

More information

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

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

A New Line Drawing Algorithm Based on Sample Rate Conversion

A New Line Drawing Algorithm Based on Sample Rate Conversion A New Line Drawing Algorithm Based on Sample Rate Conversion c 2002, C. Bond. All rights reserved. February 5, 2002 1 Overview In this paper, a new method for drawing straight lines suitable for use on

More information

CSCI 4620/8626. Coordinate Reference Frames

CSCI 4620/8626. Coordinate Reference Frames CSCI 4620/8626 Computer Graphics Graphics Output Primitives Last update: 2014-02-03 Coordinate Reference Frames To describe a picture, the world-coordinate reference frame (2D or 3D) must be selected.

More information

Efficient Plotting Algorithm

Efficient Plotting Algorithm Efficient Plotting Algorithm Sushant Ipte 1, Riddhi Agarwal 1, Murtuza Barodawala 1, Ravindra Gupta 1, Prof. Shiburaj Pappu 1 Computer Department, Rizvi College of Engineering, Mumbai, Maharashtra, India

More information

MODULE - 4. e-pg Pathshala

MODULE - 4. e-pg Pathshala e-pg Pathshala MODULE - 4 Subject : Computer Science Paper: Computer Graphics and Visualization Module: Midpoint Circle Drawing Procedure Module No: CS/CGV/4 Quadrant 1 e-text Before going into the Midpoint

More information

Scan Converting Lines

Scan Converting Lines Scan Conversion 1 Scan Converting Lines Line Drawing Draw a line on a raster screen between two points What s wrong with the statement of the problem? it doesn t say anything about which points are allowed

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques 5.1 Line A line, or straight line, is, roughly speaking, an (infinitely) thin, (infinitely) long, straight geometrical object,

More information

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk Computer Graphics Lecture 2 Doç. Dr. Mehmet Gokturk Mathematical Foundations l Hearn and Baker (A1 A4) appendix gives good review l Some of the mathematical tools l Trigonometry l Vector spaces l Points,

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

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

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization. Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

An Improved Algorithm for Scan-converting a Line

An Improved Algorithm for Scan-converting a Line An Improved Algorithm for Scan-converting a Line *Md. Hasanul Kabir 1, Md. Imrul Hassan 2, Abdullah Azfar 1 1 Department of Computer Science & Information Technology (CIT) 2 Department of Electrical &

More information

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621. CS4620/5620: Lecture 12 Rasterization 1 Announcements Turn in HW 1 PPA 1 out Friday lecture History of graphics PPA 1 in 4621 2 The graphics pipeline The standard approach to object-order graphics Many

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object... Rendering approaches 1.image-oriented foreach pixel... 2.object-oriented foreach object... geometry 3D rendering pipeline image 3D graphics pipeline Vertices Vertex processor Clipper and primitive assembler

More information

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels Pixels Pixel: Intensity or color sample. Raster Image: Rectangular grid of pixels. Rasterization: Conversion of a primitive s geometric representation into A set of pixels. An intensity or color for each

More information

Display Technologies: CRTs Raster Displays

Display Technologies: CRTs Raster Displays Rasterization Display Technologies: CRTs Raster Displays Raster: A rectangular array of points or dots Pixel: One dot or picture element of the raster Scanline: A row of pixels Rasterize: find the set

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

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

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm Drawing Circles In today s lecture we ll have a look at: Circle drawing algorithms A simple technique The mid-point circle algorithm Polygon fill algorithms Summary raster drawing algorithms A Simple Circle

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

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

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

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

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

Lines and Their Slopes

Lines and Their Slopes 8.2 Lines and Their Slopes Linear Equations in Two Variables In the previous chapter we studied linear equations in a single variable. The solution of such an equation is a real number. A linear equation

More information

Rasterization. COMP 575/770 Spring 2013

Rasterization. COMP 575/770 Spring 2013 Rasterization COMP 575/770 Spring 2013 The Rasterization Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to

More information

Scan Conversion- Polygons

Scan Conversion- Polygons Scan Conversion- olgons Flood Fill Algorithm Chapter 9 Scan Conversion (part ) Drawing olgons on Raster Displa Input polgon with rasterized edges = (x,) point inside Goal: Fill interior with specified

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16 ECM2410:GraphicsandAnimation R asterisation Part I: Simple Lines Rasterisation 1/16 Rendering a scene User space Device space Affine transformation Compose Transform Render Com pose from primitives (lines,

More information

Implicit differentiation

Implicit differentiation Roberto s Notes on Differential Calculus Chapter 4: Basic differentiation rules Section 5 Implicit differentiation What ou need to know alread: Basic rules of differentiation, including the chain rule.

More information

Shading Techniques Denbigh Starkey

Shading Techniques Denbigh Starkey Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

CPSC / Scan Conversion

CPSC / Scan Conversion CPSC 599.64 / 601.64 Computer Screens: Raster Displays pixel rasters (usually) square pixels in rectangular raster evenly cover the image problem no such things such as lines, circles, etc. scan conversion

More information

Pipeline implementation II

Pipeline implementation II Pipeline implementation II Overview Line Drawing Algorithms DDA Bresenham Filling polygons Antialiasing Rasterization Rasterization (scan conversion) Determine which pixels that are inside primitive specified

More information

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~elf Instructor: Eugene Fiume Office: BA 5266 Phone: 416 978 5472 (not a reliable way) Email:

More information

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Graphs, Linear Equations, and Functions

Graphs, Linear Equations, and Functions Graphs, Linear Equations, and Functions. The Rectangular R. Coordinate Fractions Sstem bjectives. Interpret a line graph.. Plot ordered pairs.. Find ordered pairs that satisf a given equation. 4. Graph

More information

CS452/552; EE465/505. Clipping & Scan Conversion

CS452/552; EE465/505. Clipping & Scan Conversion CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:

More information

Geometry. Slide 1 / 202. Slide 2 / 202. Slide 3 / 202. Analytic Geometry. Table of Contents

Geometry. Slide 1 / 202. Slide 2 / 202. Slide 3 / 202. Analytic Geometry. Table of Contents Slide 1 / 202 Slide 2 / 202 Geometr Analtic Geometr 201--02 www.njctl.org Table of Contents Slide 3 / 202 Origin of Analtic Geometr The Distance Formula The Midpoint Formula Partitions of a Line Segment

More information

Topic 2 Transformations of Functions

Topic 2 Transformations of Functions Week Topic Transformations of Functions Week Topic Transformations of Functions This topic can be a little trick, especiall when one problem has several transformations. We re going to work through each

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

The Graph Scale-Change Theorem

The Graph Scale-Change Theorem Lesson 3-5 Lesson 3-5 The Graph Scale-Change Theorem Vocabular horizontal and vertical scale change, scale factor size change BIG IDEA The graph of a function can be scaled horizontall, verticall, or in

More information

UNIT -8 IMPLEMENTATION

UNIT -8 IMPLEMENTATION UNIT -8 IMPLEMENTATION 1. Discuss the Bresenham s rasterization algorithm. How is it advantageous when compared to other existing methods? Describe. (Jun2012) 10M Ans: Consider drawing a line on a raster

More information

Derivatives 3: The Derivative as a Function

Derivatives 3: The Derivative as a Function Derivatives : The Derivative as a Function 77 Derivatives : The Derivative as a Function Model : Graph of a Function 9 8 7 6 5 g() - - - 5 6 7 8 9 0 5 6 7 8 9 0 5 - - -5-6 -7 Construct Your Understanding

More information

Chapter - 2 Complexity of Algorithms for Iterative Solution of Non-Linear Equations

Chapter - 2 Complexity of Algorithms for Iterative Solution of Non-Linear Equations Chapter - Compleity of Algorithms for Iterative Solution of Non-Linear Equations Compleity of Algorithms for Iterative... 19 CHAPTER - Compleity of Algorithms for Iterative Solution of Non-Linear Equations.1

More information

Points and lines. x x 1 + y 1. y = mx + b

Points and lines. x x 1 + y 1. y = mx + b Points and lines Point is the fundamental element of the picture representation. It is nothing but the position in a plan defined as either pairs or triplets of number depending on whether the data are

More information

Section Graphs and Lines

Section Graphs and Lines Section 1.1 - Graphs and Lines The first chapter of this text is a review of College Algebra skills that you will need as you move through the course. This is a review, so you should have some familiarity

More information

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Foundations of Computer Graphics Torsten Möller Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel

More information

Painter s HSR Algorithm

Painter s HSR Algorithm Painter s HSR Algorithm Render polygons farthest to nearest Similar to painter layers oil paint Viewer sees B behind A Render B then A Depth Sort Requires sorting polygons (based on depth) O(n log n) complexity

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms ! Computer Graphics 2014! 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-26! Screen Nikon D40 Sensors 3 Rasterization - The task of displaying a world modeled

More information

Computer Graphics: Line Drawing Algorithms

Computer Graphics: Line Drawing Algorithms Computer Graphics: Line Drawing Algorithms 1 Graphics hardware The problem scan conversion Considerations Line equations Scan converting algorithms A very simple solution The DDA algorithm, Bresenham algorithm

More information

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

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 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 the viewport of the current application window. A pixel

More information

CS 335 Graphics and Multimedia. Geometric Warping

CS 335 Graphics and Multimedia. Geometric Warping CS 335 Graphics and Multimedia Geometric Warping Geometric Image Operations Eample transformations Straightforward methods and their problems The affine transformation Transformation algorithms: Forward

More information

Advanced Texture-Mapping Curves and Curved Surfaces. Pre-Lecture Business. Texture Modes. Texture Modes. Review quiz

Advanced Texture-Mapping Curves and Curved Surfaces. Pre-Lecture Business. Texture Modes. Texture Modes. Review quiz Advanced Texture-Mapping Curves and Curved Surfaces Pre-ecture Business loadtexture example midterm handed bac, code posted (still) get going on pp3! more on texturing review quiz CS148: Intro to CG Instructor:

More information

EF432. Introduction to spagetti and meatballs

EF432. Introduction to spagetti and meatballs EF432 Introduction to spagetti and meatballs CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~karan/courses/418/fall2015 Instructor: Karan

More information

MATH 115: Review for Chapter 1

MATH 115: Review for Chapter 1 MATH 115: Review for Chapter 1 Can you use the Distance Formula to find the distance between two points? (1) Find the distance d P, P between the points P and 1 1, 6 P 10,9. () Find the length of the line

More information

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public

More information

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre Public

More information

Output Primitives Lecture: 4. Lecture 4

Output Primitives Lecture: 4. Lecture 4 Lecture 4 Circle Generating Algorithms Since the circle is a frequently used component in pictures and graphs, a procedure for generating either full circles or circular arcs is included in most graphics

More information

Chapter 3. Sukhwinder Singh

Chapter 3. Sukhwinder Singh 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

More information

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline

The graphics pipeline. Pipeline and Rasterization. Primitives. Pipeline The graphics pipeline Pipeline and Rasterization CS4620 Lecture 9 The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for quality and

More information

MATH SPEAK - TO BE UNDERSTOOD AND MEMORIZED

MATH SPEAK - TO BE UNDERSTOOD AND MEMORIZED FOM 11 T9 GRAPHING LINEAR EQUATIONS REVIEW - 1 MATH SPEAK - TO BE UNDERSTOOD AND MEMORIZED 1) -INTERCEPT = the point where the graph touches or crosses the -ais. It occurs when = 0. ) -INTERCEPT = the

More information

Rasterization. CS4620 Lecture 13

Rasterization. CS4620 Lecture 13 Rasterization CS4620 Lecture 13 2014 Steve Marschner 1 The graphics pipeline The standard approach to object-order graphics Many versions exist software, e.g. Pixar s REYES architecture many options for

More information

1.6 Modeling with Equations

1.6 Modeling with Equations 1.6 Modeling with Equations Steps to Modeling Problems with Equations 1. Identify the variable you want to solve for. 2. Express all unknown quantities in terms of this variable. 3. Set up the model by

More information

RASTERIZING POLYGONS IN IMAGE SPACE

RASTERIZING POLYGONS IN IMAGE SPACE On-Line Computer Graphics Notes RASTERIZING POLYGONS IN IMAGE SPACE Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis A fundamental

More information