Scan Conversion of Circles

Slides:



Advertisements
Similar presentations
Circle Drawing Asst. Prof. Dr. Ahmet Sayar Kocaeli University
Advertisements

CS 450: COMPUTER GRAPHICS DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
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.
Komputer Grafik 2 (AK045206) Scan Conversion 1/31 Scan Conversion.
Raster conversion algorithms for line and circle
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics May 3, 2007.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
Circle Drawing algo..
CGMB214: Introduction to Computer Graphics
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
Dr. Scott Schaefer Scan Conversion of Lines. 2/78 Displays – Cathode Ray Tube.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
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.
Jehee Lee Seoul National University
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.
Larry F. Hodges 1 Design of Line and Circle Algorithms.
10/15/02 (c) 2002 University of Wisconsin, CS559 Last Time Clipping.
1 Circle Drawing Algorithms Pictures snagged from
What is the standard form of a parabola who has a focus of ( 1,5) and a directrix of y=11.
Graphics Output Primitives
Chapter 3 Scan Conversion Lecture-02. Bresenham’s Line Algorithm Bresenham’s line algorithm – is a highly efficient incremental method for scan- converting.
ELLIPSE GENERATING ALGORITHMS 1. DEFINITION Ellipse is an elongated circle. Elliptical curves can be generated by modifying circle-drawing procedures.
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
November 18, We could solve for y in terms of x ( x 0, y 0 ) are the origin points A Simple Circle Drawing Algorithm The equation for a circle.
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
Midpoint Circle Algorithm
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
Hyperbolas. Hyperbola: a set of all points (x, y) the difference of whose distances from two distinct fixed points (foci) is a positive constant. Similar.
1 Bresenham’s Circle Algorithm Define:D(s i ) = distance of p 3 from circle D(t i ) = distance of p 2 from circle i.e.D(s i ) = (x i + 1) 2 + y i 2 – r.
Scan Conversion.
Instructor: Dr. Shereen Aly Taie If (P>0)
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.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
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.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
CS552: Computer Graphics Lecture 16: Polygon Filling.
Primitive graphic objects
Scan Conversion or Rasterization
MID-POINT CIRCLE ALGORITHM
Parametric equations Parametric equation: x and y expressed in terms of a parameter t, for example, A curve can be described by parametric equations x=x(t),
Lecture 31 – Conic Sections
(c) 2002 University of Wisconsin, CS559
Scan Conversion or Rasterization
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Prof. Harriet Fell Spring 2007 Lecture 5 – January 17, 2006
Chapter Three Part I Output Primitives CS 380.
Scan Conversion of Lines
Fitting Curve Models to Edges
© University of Wisconsin, CS559 Fall 2004
Chapter 3 Conics 3.4 The Ellipse MATHPOWERTM 12, WESTERN EDITION
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
Chapter 3 Conics 3.4 The Ellipse MATHPOWERTM 12, WESTERN EDITION
Scan Conversion (From geometry to pixels)
Chapter 10 Conic Sections.
Chapter 3 Graphics Output Primitives
Chapter 1 Test Review.
OUTPUT PRIMITIVES / DISPLAY TECHNIQUES
Presentation transcript:

Scan Conversion of Circles Generalization of the line algorithm Assumptions: circle at (0,0) Fill 1/8 of the circle, then use symmetry Not using the 8-way symmetry of a circle Using the 8-way symmetry of a circle: 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Scan Conversion of Circles Implicit representation of the circle function: Note: < 0 for points inside the circle, and > 0 for points outside the circle

Scan Conversion of Circles Assume we finished pixel What pixel to draw next? (going clockwise) Note: the slope of the circular arc is between 0 and –1 Hence, choice is between: E and SE Idea: If the circle passes above the midpoint M, then we go to E next, otherwise we go to SE 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Scan Conversion of Circles We need a decision variable D: If then M is below the arc, hence the E pixel is closer to the line. If then M is above the arc, hence the SE pixel is closer to the line. 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Case I: When E is next What increment for computing a new D? Next midpoint is: Hence, increment by: Pics/Math courtesy of Dave Mount @ UMD-CP

Case II: When SE is next What increment for computing a new D? Next midpoint is: Hence, increment by: Pics/Math courtesy of Dave Mount @ UMD-CP

Scan Conversion of Circles How to compute the initial value of D: We start with x = 0 and y = R, so the first midpoint is at x = 1, y = R-1/2:

Scan Conversion of Circles Converting this to an integer algorithm: Need only know if D is positive or negative D & R are integers Note D is incremented by an integer value Therefore D + 1/4 is positive only when D is positive; it is safe to drop the 1/4 Hence: set the initial D to 1 – R (subtracting 1/4)

Circle Scan Conversion Algorithm Given radius R and center (0, 0) First point  (0, R) Initial decision parameter D = 1- R While x  y If (D < 0) x++; D += 2x + 3; else x++; y--; D += 2(x - y) + 5 WritePoints(x,y)

WritePoints(x,y) Writes pixels to the seven other octants

Properties of Ellipses “Elongated circle” For all points on ellipse, sum of distances to foci is constant d1+ d2 = const If F1=(x1, y1) and   F2=(x2, y2) then

Properties of Ellipses Equation simplified if ellipse axis parallel to coordinate axis Parametric form

Symmetry Considerations 4-way symmetry Unit steps in x until reach region boundary Switch to unit steps in y Step in x while Switch to steps in y when

Midpoint Algorithm (initializing) Similar to circles The initial value for region 1 The initial value for region 2 We have initial values, now we need the increments 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Making a Decision Computing the decision variable If then M is below the arc, hence the E pixel is closer to the line. If then M is above the arc, hence the SE pixel is closer to the line. 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Computing the Increment E case SE case 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Computing the Increment in 2nd Region Decision variable in 2nd region If then M is left of the arc, hence the SE pixel is closer to the line. If then M is right of the arc, hence the S pixel is closer to the line. 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Computing the Increment in 2nd Region SE case S case 1994 Foley/VanDam/Finer/Huges/Phillips ICG

Midpoint Algorithm for Ellipses Region 2 Region 1 Set first point to (0,ry) Set the Decision variable to Loop (x = x+1) If D < 0 then pick E and If D ≥ 0 then pick SE and Until Set first point to the last computed Set the Decision variable to Loop (y = y - 1) If D < 0 then pick SE and If D ≥ 0 then pick S and Until y < 0 Use symmetry to complete the ellipse