Bresenham’s Midpoint Algorithm CS5600 Computer Graphics Rich Riesenfeld Spring 2006 Lecture Set 1.

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

CS 450: COMPUTER GRAPHICS DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
+ CPCS 391 Computer Graphics 1 Instructor: Dr. Sahar Shabanah Lecture 3.
Scan conversion of Line , circle & ellipse
Larry F. Hodges (modified by Amos Johnson) 1 Design of Line, Circle & Ellipse Algorithms.
Lecture 17 Fun with Graphics Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
Lecture 16 Fun with graphics
Copyright © Cengage Learning. All rights reserved. 14 Partial Derivatives.
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
Komputer Grafik 2 (AK045206) Scan Conversion 1/31 Scan Conversion.
3/2/04© University of Wisconsin, CS559 Spring 2004 Last Time General Perspective –Methods for specifying the view volume As a set of clip planes As a field.
Thursday, April 25 Nonlinear Programming Theory Separable programming Handouts: Lecture Notes.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Circle Drawing algo..
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
CS 325 Introduction to Computer Graphics 03 / 03 / 2010 Instructor: Michael Eckmann.
Dr. Scott Schaefer Scan Conversion of Lines. 2/78 Displays – Cathode Ray Tube.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Scan Conversion. Also known as rasterization In our programs objects are represented symbolically –3D coordinates representing an object’s position –Attributes.
College of Computer and Information Science, Northeastern UniversitySeptember 12, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture.
1 CS 430/536 Computer Graphics I Circle Drawing and Clipping Week 3, Lecture 6 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
Dr. S.M. Malaek Assistant: M. Younesi
Graphics Primitives: line. Pixel Position
WHERE TO DRAW A LINE?? Line drawing is accomplished by calculating intermediate positions along the line path between specified end points. Precise definition.
Scan Conversion Line and Circle
CS 450: COMPUTER GRAPHICS REVIEW: DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Line Integrals.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Larry F. Hodges 1 Design of Line and Circle Algorithms.
College of Computer and Information Science, Northeastern UniversityOctober 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
Graphics Graphics & Graphical Programming Lecture 14 - Lines & Circles.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
1 Line Drawing Version B: Semi-Formal Methods Derivation ©Anthony Steed
Graphics Output Primitives
Line Drawing and Generalization. Outline  overview  line drawing  circle drawing  curve drawing.
ME 2304: 3D Geometry & Vector Calculus
Computer Graphics Drawing Line. Lines and Polylines Convex: For every pair of points in the polygon, the line between them is fully contained in the polygon.
Computer Graphics Rendering 2D Geometry CO2409 Computer Graphics Week 2.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Midpoint Circle Algorithm
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Line Clipping & Line Rasterization.
Scan Conversion.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Clipping & Line Rasterization.
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Line Drawing Algorithms 1. A line in Computer graphics is a portion of straight line that extends indefinitely in opposite direction. 2. It is defined.
Scan Conversion or Rasterization
Computer Graphics Drawing Line.
CS G140 Graduate Computer Graphics
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Scan Conversion or Rasterization
Prof. Harriet Fell Spring 2007 Lecture 5 – January 17, 2006
Chapter Three Part I Output Primitives CS 380.
CSCE 441 Lecture 2: Scan Conversion of Lines
2D Scan-line Conversion
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
Edited from The Rasterization Problem: Idealized Primitives Map to Discrete Display Space Edited from.
Chapter 3 Graphics Output Primitives
OUTPUT PRIMITIVES / DISPLAY TECHNIQUES
Presentation transcript:

Bresenham’s Midpoint Algorithm CS5600 Computer Graphics Rich Riesenfeld Spring 2006 Lecture Set 1

Spring 2006CS Line Characterizations Explicit: Implicit: Constant slope: Constant derivative:

Spring 2006CS Line Characterizations - 2 Parametric: where, Intersection of 2 planes Shortest path between 2 points Convex hull of 2 discrete points

Spring 2006CS Discrete Lines Lines vs. Line Segments What is a discrete line segment? –This is a relatively recent problem –How to generate a discrete line?

Spring 2006CS “Good” Discrete Line - 1 No gaps in adjacent pixels Pixels close to ideal line Consistent choices; same pixels in same situations

Spring 2006CS “Good” Discrete Line - 2 Smooth looking Even brightness in all orientations Same line for as for Double pixels stacked up?

Spring 2006CS Incremental Fn Eval Recall Characteristics –Fast –Cumulative Error Need to define

Spring 2006CS Meeting Bresenham Criteria

Spring 2006CS Case 1: Translate to Origin

Spring 2006CS Case 0: Trivial Situations Do not need Bresenham

Spring 2006CS Case 1: Translate to Origin Need only consider lines emanating from the origin.

Spring 2006CS Case 2: Flip about x-axis

Spring 2006CS Case 2: Flip about x-axis

Spring 2006CS How do slopes relate?

Spring 2006CS How do slopes relate? i.e.,

Spring 2006CS Case 3: Flip about line y = x

Spring 2006CS Case 3: Flip about line y = x

Spring 2006CS Case 3: m′ = ?

Spring 2006CS Line segment in first octant with 0 < m < 1 Let us proceed Restricted Form

Spring 2006CS Two Line Equations Explicit: Implicit: Define: Hence,

Spring 2006CS From previous We have, Hence,

Spring 2006CS Relating Explicit to Implicit Eq’s Recall, Or, where,

Spring 2006CS Investigate Sign of F Verify that Look at extreme values of y above line below line on line

Spring 2006CS The Picture above line below line

Spring 2006CS Key to Bresenham Algorithm “Reasonable assumptions” have reduced the problem to making a binary choice at each pixel: (Previous) NE (next) E (next)

Spring 2006CS Decision Variable d (logical) Define a logical decision variable d – linear in form – incrementally updated (with addition) – tells us whether to go E or NE

Spring 2006CS The Picture ideal line midpoint E NE previous Q M

Spring 2006CS The Picture (again) ideal line E NE previous Q midpoint M

Spring 2006CS Observe the relationships Suppose Q is above M, as before. Then, M is below the line So, means line is above M, Need to move NE, increase y value

Spring 2006CS The Picture (again) ideal line midpoint E NE previous Q

Spring 2006CS Observe the relationships Suppose Q is below M, as before. Then F (M) < 0, implies M is above the line So, F (M) < 0, means line is below M, Need to move to E; don’t increase y

Spring 2006CS M = Midpoint = : Want to evaluate at M Will use an incr decision var d Let,

Spring 2006CS How will d be used? Recall, Therefore,

Spring 2006CS Case 1: Suppose E is chosen Recall...

Spring 2006CS Case 1: Suppose E is chosen

Spring 2006CS Review of Explicit to Implicit Recall, Or, where,

Spring 2006CS Case 1:.

Spring 2006CS Case 2: Suppose NE chosen Recall...

Spring 2006CS Case 2: Suppose NE...

Spring 2006CS Case 2:.

Spring 2006CS Case 2:.

Spring 2006CS Summary At each step of the procedure, we must choose between moving E or NE based on the sign of the decision variable d Then update according to

Spring 2006CS What is initial value of d ? First point is First midpoint is What is initial midpoint value?

Spring 2006CS What is initial value of d ?

Spring 2006CS What is initial value of d ? Hence,

Spring 2006CS What is initial value of d ? Hence,

Spring 2006CS What Does “2 x ” Do ? Has the same 0-set Changes the slope of the plane Rotates plane about the 0-set line

Spring 2006CS What is initial value of d ?

Spring 2006CS What is initial value of d ?

Spring 2006CS More Summary Initial value Case 1: Case 2:

Spring 2006CS More Summary Choose

Spring 2006CS Example Line end points: Deltas:

Spring 2006CS Graph

Spring 2006CS Example ( dx = 4; dy = 3 ) Initial value of

Spring 2006CS Graph

Spring 2006CS Example ( dx = 4; dy = 3 ) Update value of d

Spring 2006CS Example ( dx = 4; dy = 3 ) -2 Update value of d Last move was NE, so 2d(6,9) = 2d(y - dy) = 2(4 - 3) = - 2 d = 2 – 2 = 0  E

Spring 2006CS Graph

Spring 2006CS Example ( dx = 4; dy = 3 ) Previous move was E

Spring 2006CS Graph

Spring 2006CS Example ( dx = 4; dy = 3 ) Previous move was

Spring 2006CS Graph

Spring 2006CS Graph

Spring 2006CS Graph

Spring 2006CS More Raster Line Issues Fat lines with multiple pixel width Symmetric lines How should end pt geometry look? Generating curves, e.g., circles, etc. Jaggies, staircase effect, aliasing...

Spring 2006CS Pixel Space

Example

Spring 2006CS Bresenham Circles

Spring 2006CS The End Bresenham’s Algorithm Lecture Set 1