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

Size: px
Start display at page:

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

Transcription

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

2 OPENGL POINTS AND LINES

3 OPENGL POINTS AND LINES In OenGL, there are different constants used to indicate what ind of rimitive we are tring to draw For oints, we have GL_POINTS For lines, we have GL_LINES, GL_LINE_STRIP, and GL_LINE_LOOP

4 DRAWING POINTS: LEGACY VS. NEW To draw oints in legac OenGL: glbegingl_points); glverte3f,5,0); glverte3f,3,); glend); To draw oints in OenGL 3.0+, we set u our buffers and then call: gldrawarrasgl_points, 0, ointcnt); For other rimitives lie lines), the rocedure would be the same just relace GL_POINTS with what ou want instead.

5 DRAWING LINES Deending on which constant we choose, the lines will be drawn differentl GL_LINES = draw individual lines with ever vertices GL_LINE_STRIP = draw a olline connecting all vertices in sequence GL_LINE_LOOP = draw a olline, and then also connect the first and last vertices

6 DRAWING LINES glbegingl_lines); glverteiv) glverteiv); glverteiv3); glverteiv4); glverteiv5); glend); NOTE: 5 is ignored, since there isn t another verte to air it with ALSO NOTE: the v art means assing in an arra

7 DRAWING LINES glbegingl_line_strip); glverteiv) glverteiv); glverteiv3); glverteiv4); glverteiv5); glend); Creates a olline

8 DRAWING LINES glbegingl_line_loop); glverteiv) glverteiv); glverteiv3); glverteiv4); glverteiv5); glend); Creates a closed olline

9 DDA LINE DRAWING ALGORITHM

10 THE PROBLEM WITH PIXELS Prett much all modern dislas use a grid of iels to disla images Discrete digital) locations Problem: when drawing lines that aren t erfectl horizontal, vertical, or diagonal, the oints in the middle of the line do not fall erfectl into the iel locations I.e., have to round line coordinates to integers Lines end u having this stair-ste effect jaggies ) aliasing

11 LINE EQUATIONS A straight line can be mathematicall defined using the Cartesian sloe-intercet equation: m b We re dealing with line segments, so these have secified starting and ending oints: So, we can comute the sloe m and the intercet b as follows: m b 0 end end m , 0) end, end )

12 INTERVALS For a given interval δ along a line, we can comute the corresonding interval δ: m Similarl, we can get δ from δ: m

13 DDA ALGORITHM Digital differential analzer DDA) Scan-conversion line algorithm based on calculating either d or d Samle one coordinate at unit intervals find nearest integer value for other coordinate Eamle: 0 < m <=.0 sloe ositive, with δ > δ) Increment in unit intervals δ = ) Comute successive values as follows: Round value to nearest integer m

14 DDA ALGORITHM: M >.0 Problem: If sloe is ositive AND greater than.0 m >.0), then we increment b si iels in! Solution: swa roles of and! Increment in unit intervals δ = ) Comute 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 absd) > absd): Ste in X Otherwise: Ste in Y m end end 0 0 d d We ll see later in another algorithm an eas wa to do this is to swa the roles of and So is reall, and is reall

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

17 DDA ALGORITHM: CODE // Get d and d int d = - 0; int d = - 0; int stes, ; float Increment, Increment; // Set starting oint float = 0; float = 0;

18 DDA ALGORITHM: CODE // Determine which coordinate we should ste in if absd) > absd)) stes = absd); else stes = absd); // Comute increments Increment = floatd) / floatstes); Increment = floatd) / floatstes);

19 DDA ALGORITHM: CODE // Let s assume we have a magic function called setpiel,) that sets a iel at,) to the aroriate color. // Set value of iel at starting oint setpielround), round)); // For each ste for = 0; < stes; ++) { // Increment both and += Increment; += Increment; } // Set iel 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 sloe-intercet form directl no multilication, onl addition Caveat: initial division necessar Disadvantages: Accumulation of round-off error can cause the line to drift off true ath Rounding rocedure still time-consuming Question: can we do this with nothing but integers?

21 YES Yes, we can.

22 BRESENHAM S LINE DRAWING ALGORITHM

23 BRESENHAM S LINE ALGORITHM: INTRODUCTION Taes advantage of fact that sloe m is reall a fraction of integers Sa we have a ositive sloe and d > d so we re incrementing in ) We have a iel lotted at, ) Given +, the net value is going to be either: + The question is: which one is closer to the real line? +, ) or +, +)?

24 BRESENHAM S LINE ALGORITHM: THE IDEA The basic idea is to loo at a decision variable to hel us mae the choice at each ste Our revious osition:, ) d lower = distance of +, ) from the true line coordinate +, ) d uer = distance of +, + ) from the true line coordinate +, )

25 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 uer lower ) ) )

26 BRESENHAM S LINE ALGORITHM: MORE MATH To determine which of the two iels is closer to the true line ath, we can loo at the sign of the following: Positive d uer is smaller choose + ) Negative d lower is smaller choose ) ) ) ) ) ) ) b m b m b m b m b m d d uer lower

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

28 BRESENHAM S LINE ALGORITHM: DECISION VARIABLE c Multiling b Δ won t affect the sign of, since Δ > 0 Note that constant c does not deend on the current osition at all, so can comute it ahead of time: So, as before: c b ) ositive d uer is smaller choose + ) negative d lower is smaller choose

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

30 BRESENHAM S LINE ALGORITHM: UPDATING P K However, we now: Therefore: So, we need to determine what + ) was: If was ositive + ) = If was negative + ) = 0

31 BRESENHAM S LINE ALGORITHM: SUMMARIZED. Inut two line endoints and store LEFT endoint in 0, 0 ). Plot first oint 0, 0 ) 3. Comute constants Δ, Δ, Δ, and Δ - Δ. Also comute first value of decision variable: 0 = Δ Δ 4. At each, test : If < 0 lot +, ) + = + Δ Otherwise lot +, +) + = + Δ - Δ 5. Perform ste 4 Δ ) times NOTE: Effectivel assuming line starts at 0,0) and thus b = 0 0) 0) 0) ) ) b ) NOTE: This version ONLY wors with 0 < m <.0!!! Ergo, Δ and Δ are ositive here!

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

33 BRESENHAM S LINE ALGORITHM: CODE // Determine which endoint to use as start osition if0 > ) { = ; = ; = 0; } else { = 0; = 0; } // Plot first iel setpiel,);

34 BRESENHAM S LINE ALGORITHM: CODE while < ) { ++; } if < 0) += twod; else { ++; += twodminusd; } setpiel,);

35 BRESENHAM S LINE ALGORITHM: GENERALIZED What we re taled about onl wors with 0 < m <.0 For other sloes, we tae advantage of smmetr: If d > d swa and WARNING: Would then need to call setpiel, ) After swaing endoints and otentiall swaing and, if 0 > decrement rather than increment NOTE: ma actuall be if ou swaed them Two more warnings: ) In the samle code, d and d are ABSOLUTE VALUES ) In the net image, when I sa and, I mean the actual and

36

37 BRESENHAM S LINE ALGORITHM: SPECIAL CASES To save time, if ou have a line that is: Δ = 0 vertical) Δ = 0 horizontal) Δ = Δ diagonal) ou can just draw it directl without going through the entire algorithm.

38 MIDPOINT ALGORITHM A more general wa of viewing Bresenham s Algorithm that can be alied to other conics is called the Midoint Algorithm: Uses the imlicit reresentation e.g., imlicit line equation If a oint is on the inside, F,) < 0 If a oint is on the outside, F,) > 0 If a oint is eactl on the boundar, F,) = 0 Test whether the oint F+, + ½) is inside or outside choose closest oint F, ) A B C 0

39 MIDPOINT CIRCLE ALGORITHM

40 INTRODUCTION A circle can be defined b its imlicit form: c, c ) center of circle r = radius Since a circle is smmetric in all 8 octants just comute one octant and relicate in others 0 ) ) ), r F c c

41 DECISION VARIABLE Assume the circle is centered at 0,0) We re going to start b: Incrementing b Choose whether to go down or not in To determine our net choice, we will loo at our decision variable based on the midoint +, - ½): If < 0 midoint inside circle choose If > 0 midoint outside circle choose - F ), r

42 UPDATING THE DECISION VARIABLE To figure out how to udate the decision variable, let s loo at the net value: ), r F ), r F Remember:

43 HOLD ON TO YOUR MATHEMATICAL HATS ), r F Remember: ) ) ) 4 4 ) ) 4 4 ) ) ) r r r r r r

44 NEXT DECISION VARIABLE + is: if < 0 - ) if > 0 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )

45 UPDATING THE DECISION VARIABLE If < 0 add + + If > 0 add We can also udate + and + incrementall: ) )

46 INITIAL VALUES We will start at 0,r) Initial decision variable value: 0 F, r 5 4 r ) r r r r r 4 However, if our radius r is an integer, we can round 0 to 0 = r, since all increments are integers

47 MIDPOINT CIRCLE ALGORITHM SUMMARIZED. Inut radius r and circle center c, c ); first oint = 0, 0 ) = 0,r). Calculate initial decision variable value: 5 0 r 4 3. At each, test : If < 0 net oint is +, ) and: Otherwise net oint is +, - ) and: Where: 4. For each calculated osition,), lot + c, + c ) 5. Plot corresonding smmetric oints in other seven octants 6. Reeat stes 3 through 5 UNTIL >=

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

CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE CS 45: COMPUTER GRAPHICS RASTERIZING LINES SPRING 6 DR. MICHAEL J. REALE OBJECT-ORDER RENDERING We going to start on how we will perform object-order rendering Object-order rendering Go through each OBJECT

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

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms Chater : Grahics Outut Primitives Primitives: functions in grahics acage that we use to describe icture element Points and straight lines are the simlest rimitives Some acages include circles, conic sections,

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

Computer Graphics. Computer Graphics. Lecture 3 Line & Circle Drawing

Computer Graphics. Computer Graphics. Lecture 3 Line & Circle Drawing Comuter Grahics Comuter Grahics Lecture 3 Line & Circle Drawing Comuter Grahics Towards the Ideal Line We can onl do a discrete aroimation Illuminate iels as close to the true ath as ossible, consider

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

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

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

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

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

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

CS 450: COMPUTER GRAPHICS RASTERIZING CONICS SPRING 2016 DR. MICHAEL J. REALE CS 45: COMPUTER GRAPHICS RASTERIZING CONICS SPRING 6 DR. MICHAEL J. REALE RASTERIZING CURVES OTHER THAN LINES When dealing with othe inds of cuves, we can daw it in one of the following was: Use elicit

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

Raster Graphics Algorithms

Raster Graphics Algorithms Overview of Grahics Pieline Raster Grahics Algorithms D scene atabase traverse geometric moel transform to worl sace transform to ee sace scan conversion Line rasterization Bresenham s Mioint line algorithm

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

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

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

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

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

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

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

Dr Pavan Chakraborty IIIT-Allahabad

Dr Pavan Chakraborty IIIT-Allahabad GVC-43 Lecture - 5 Ref: Donald Hearn & M. Pauline Baker, Comuter Grahics Foley, van Dam, Feiner & Hughes, Comuter Grahics Princiles & Practice Dr Pavan Chakraborty IIIT-Allahabad Summary of line drawing

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

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

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

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

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

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

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

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

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

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

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS 2D TRANSFORMATIONS SPRING 2016 DR. MICHAEL J. REALE CS 45: COMUTER GRAHICS 2D TRANSFORMATIONS SRING 26 DR. MICHAEL J. REALE INTRODUCTION Now that we hae some linear algebra under our resectie belts, we can start ug it in grahics! So far, for each rimitie,

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

(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

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

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

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

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

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

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

521493S Computer Graphics Exercise 3 (Chapters 6-8)

521493S Computer Graphics Exercise 3 (Chapters 6-8) 521493S Comuter Grahics Exercise 3 (Chaters 6-8) 1 Most grahics systems and APIs use the simle lighting and reflection models that we introduced for olygon rendering Describe the ways in which each of

More information

This library uses only GL functions but contains code for creating common objects and simplifying viewing.

This library uses only GL functions but contains code for creating common objects and simplifying viewing. PES Institute of Technology, Bangalore South Campus (Formerly PES School of Engineering) (Hosur Road, 1KM before Electronic City, Bangalore-560 100) INTERNAL TEST (SCHEME AND SOLUTION) 1 Subject Name:

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

CS488 2D Graphics. Luc RENAMBOT

CS488 2D Graphics. Luc RENAMBOT CS488 2D Graphics Luc RENAMBOT 1 Topics Last time, hardware and frame buffer Now, how lines and polygons are drawn in the frame buffer. Then, how 2D and 3D models drawing into the frame buffer Then, more

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

(Refer Slide Time: 9:36)

(Refer Slide Time: 9:36) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 13 Scan Converting Lines, Circles and Ellipses Hello and welcome to the lecture

More information

2-3. Attributes of Absolute Value Functions. Key Concept Absolute Value Parent Function f (x)= x VOCABULARY TEKS FOCUS ESSENTIAL UNDERSTANDING

2-3. Attributes of Absolute Value Functions. Key Concept Absolute Value Parent Function f (x)= x VOCABULARY TEKS FOCUS ESSENTIAL UNDERSTANDING - Attributes of Absolute Value Functions TEKS FOCUS TEKS ()(A) Graph the functions f() =, f() =, f() =, f() =,f() = b, f() =, and f() = log b () where b is,, and e, and, when applicable, analze the ke

More information

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation

Simple example. Analysis of programs with pointers. Points-to relation. Program model. Points-to graph. Ordering on points-to relation Simle eamle Analsis of rograms with ointers := 5 tr := @ *tr := 9 := rogram S1 S2 S3 S4 deendences What are the deendences in this rogram? Problem: just looking at variable names will not give ou the correct

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

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

Transformations of Absolute Value Functions. Compression A compression is a. function a function of the form f(x) = a 0 x - h 0 + k

Transformations of Absolute Value Functions. Compression A compression is a. function a function of the form f(x) = a 0 x - h 0 + k - Transformations of Absolute Value Functions TEKS FOCUS VOCABULARY Compression A compression is a TEKS (6)(C) Analze the effect on the graphs of f() = when f() is replaced b af(), f(b), f( - c), and f()

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

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

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

Computer Graphics. Chapter 3 Computer Graphics Software

Computer Graphics. Chapter 3 Computer Graphics Software Computer Graphics Chapter 3 Computer Graphics Software Outline Graphics Software Packages Introduction to OpenGL Example Program 2 3 Graphics Software Software packages General Programming Graphics Packages

More information

y = f(x) x (x, f(x)) f(x) g(x) = f(x) + 2 (x, g(x)) 0 (0, 1) 1 3 (0, 3) 2 (2, 3) 3 5 (2, 5) 4 (4, 3) 3 5 (4, 5) 5 (5, 5) 5 7 (5, 7)

y = f(x) x (x, f(x)) f(x) g(x) = f(x) + 2 (x, g(x)) 0 (0, 1) 1 3 (0, 3) 2 (2, 3) 3 5 (2, 5) 4 (4, 3) 3 5 (4, 5) 5 (5, 5) 5 7 (5, 7) 0 Relations and Functions.7 Transformations In this section, we stud how the graphs of functions change, or transform, when certain specialized modifications are made to their formulas. The transformations

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

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations

Transformations of Functions. 1. Shifting, reflecting, and stretching graphs Symmetry of functions and equations Chapter Transformations of Functions TOPICS.5.. Shifting, reflecting, and stretching graphs Smmetr of functions and equations TOPIC Horizontal Shifting/ Translation Horizontal Shifting/ Translation Shifting,

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

GRAPHING QUADRATIC FUNCTIONS IN STANDARD FORM

GRAPHING QUADRATIC FUNCTIONS IN STANDARD FORM FOM 11 T7 GRAPHING QUADRATIC FUNCTIONS IN STANDARD FORM 1 1 GRAPHING QUADRATIC FUNCTIONS IN STANDARD FORM I) THE STANDARD FORM OF A QUADRATIC FUNCTION (PARABOLA) IS = a +b +c. To graph a quadratic function

More information

20 Calculus and Structures

20 Calculus and Structures 0 Calculus and Structures CHAPTER FUNCTIONS Calculus and Structures Copright LESSON FUNCTIONS. FUNCTIONS A function f is a relationship between an input and an output and a set of instructions as to how

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

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

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

CS-321 Thursday 12 September 2002 Quiz (3 pts.) What is the purpose of a control grid in a cathode ray tube (CRT)?

CS-321 Thursday 12 September 2002 Quiz (3 pts.) What is the purpose of a control grid in a cathode ray tube (CRT)? Name CS-321 Thursday 12 September 2002 Quiz 1 1. (3 pts.) What is the purpose of a control grid in a cathode ray tube (CRT)? 2. (7 pts.) For the same resolution in pixels (for example, 640x480), why does

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: 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

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

Functions Project Core Precalculus Extra Credit Project

Functions Project Core Precalculus Extra Credit Project Name: Period: Date Due: 10/10/1 (for A das) and 10/11/1(for B das) Date Turned In: Functions Project Core Precalculus Etra Credit Project Instructions and Definitions: This project ma be used during the

More information

CS5620 Intro to Computer Graphics

CS5620 Intro to Computer Graphics CS560 Reminder - Pieline Polgon at [(,9), (5,7), (8,9)] Polgon at [ ] D Model Transformations Reminder - Pieline Object Camera Cli Normalied device Screen Inut: Polgons in normalied device Model-view Projection

More information

Using Characteristics of a Quadratic Function to Describe Its Graph. The graphs of quadratic functions can be described using key characteristics:

Using Characteristics of a Quadratic Function to Describe Its Graph. The graphs of quadratic functions can be described using key characteristics: Chapter Summar Ke Terms standard form of a quadratic function (.1) factored form of a quadratic function (.1) verte form of a quadratic function (.1) concavit of a parabola (.1) reference points (.) transformation

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

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

Week 3. Topic 5 Asymptotes

Week 3. Topic 5 Asymptotes Week 3 Topic 5 Asmptotes Week 3 Topic 5 Asmptotes Introduction One of the strangest features of a graph is an asmptote. The come in three flavors: vertical, horizontal, and slant (also called oblique).

More information

1 Points and Distances

1 Points and Distances Ale Zorn 1 Points and Distances 1. Draw a number line, and plot and label these numbers: 0, 1, 6, 2 2. Plot the following points: (A) (3,1) (B) (2,5) (C) (-1,1) (D) (2,-4) (E) (-3,-3) (F) (0,4) (G) (-2,0)

More information

of Straight Lines 1. The straight line with gradient 3 which passes through the point,2

of Straight Lines 1. The straight line with gradient 3 which passes through the point,2 Learning Enhancement Team Model answers: Finding Equations of Straight Lines Finding Equations of Straight Lines stud guide The straight line with gradient 3 which passes through the point, 4 is 3 0 Because

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

2.8 Distance and Midpoint Formulas; Circles

2.8 Distance and Midpoint Formulas; Circles Section.8 Distance and Midpoint Formulas; Circles 9 Eercises 89 90 are based on the following cartoon. B.C. b permission of Johnn Hart and Creators Sndicate, Inc. 89. Assuming that there is no such thing

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

Graphing Quadratics: Vertex and Intercept Form

Graphing Quadratics: Vertex and Intercept Form Algebra : UNIT Graphing Quadratics: Verte and Intercept Form Date: Welcome to our second function famil...the QUADRATIC FUNCTION! f() = (the parent function) What is different between this function and

More information

Numerical Precision. Or, why my numbers aren t numbering right. 1 of 15

Numerical Precision. Or, why my numbers aren t numbering right. 1 of 15 Numerical Precision Or, why my numbers aren t numbering right 1 of 15 What s the deal? Maybe you ve seen this #include int main() { float val = 3.6f; printf( %.20f \n, val); Print a float with

More information

To Do. Computer Graphics (Fall 2004) Course Outline. Course Outline. Motivation. Motivation

To Do. Computer Graphics (Fall 2004) Course Outline. Course Outline. Motivation. Motivation Comuter Grahics (Fall 24) COMS 416, Lecture 3: ransformations 1 htt://www.cs.columbia.edu/~cs416 o Do Start (thinking about) assignment 1 Much of information ou need is in this lecture (slides) Ask A NOW

More information

LESSON 3.1 INTRODUCTION TO GRAPHING

LESSON 3.1 INTRODUCTION TO GRAPHING LESSON 3.1 INTRODUCTION TO GRAPHING LESSON 3.1 INTRODUCTION TO GRAPHING 137 OVERVIEW Here s what ou ll learn in this lesson: Plotting Points a. The -plane b. The -ais and -ais c. The origin d. Ordered

More information

Week 10. Topic 1 Polynomial Functions

Week 10. Topic 1 Polynomial Functions Week 10 Topic 1 Polnomial Functions 1 Week 10 Topic 1 Polnomial Functions Reading Polnomial functions result from adding power functions 1 together. Their graphs can be ver complicated, so the come up

More information

Graphing Equations. The Rectangular Coordinate System

Graphing Equations. The Rectangular Coordinate System 3.1 Graphing Equations The Rectangular Coordinate Sstem Ordered pair two numbers associated with a point on a graph. The first number gives the horizontal location of the point. The second gives the vertical

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

void drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend();

void drawdot(glint x, GLint y) { glbegin(gl_points); glvertex2i(x,y); glend(); CSC 706 Computer Graphics Primitives, Stippling, Fitting In OpenGL Primitives Examples: GL_POINTS GL_LINES GL_LINE_STRIP GL_POLYGON GL_LINE_LOOP GL_ TRIANGLES GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN

More information

2.2 Absolute Value Functions

2.2 Absolute Value Functions . Absolute Value Functions 7. Absolute Value Functions There are a few was to describe what is meant b the absolute value of a real number. You ma have been taught that is the distance from the real number

More information

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

2D Graphics Primitives II. Additional issues in scan converting lines. 1)Endpoint order. Want algorithms to draw the same pixels for each line walters@buffalo.edu CSE 480/580 Lecture 8 Slide 1 2D Graphics Primitives II Additional issues in scan converting lines 1)Endpoint order Want algorithms to draw the same pixels for each line How handle?

More information

Does the table or equation represent a linear or nonlinear function? Explain.

Does the table or equation represent a linear or nonlinear function? Explain. Chapter Review Dnamic Solutions available at BigIdeasMath.com. Functions (pp. 0 0) Determine whether the relation is a function. Eplain. Ever input has eactl one output. Input, 5 7 9 Output, 5 9 So, the

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

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

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

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

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

GRAPHS AND GRAPHICAL SOLUTION OF EQUATIONS

GRAPHS AND GRAPHICAL SOLUTION OF EQUATIONS GRAPHS AND GRAPHICAL SOLUTION OF EQUATIONS 1.1 DIFFERENT TYPES AND SHAPES OF GRAPHS: A graph can be drawn to represent are equation connecting two variables. There are different tpes of equations which

More information

Pointers CMPE-013/L. Pointers. Pointers What do they do? Pointers What are pointers? Gabriel Hugh Elkaim Winter 2014

Pointers CMPE-013/L. Pointers. Pointers What do they do? Pointers What are pointers? Gabriel Hugh Elkaim Winter 2014 CMPE-013/L A Variable's versus A Variable's Value In some situations, we will want to work with a variable's address in memor, rather than the value it contains Gabriel Hugh Elkaim Winter 2014 Variable

More information

Name Course Days/Start Time

Name Course Days/Start Time Name Course Days/Start Time Mini-Project : The Library of Functions In your previous math class, you learned to graph equations containing two variables by finding and plotting points. In this class, we

More information