MID-POINT CIRCLE ALGORITHM

Slides:



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

Contents In today’s lecture we’ll have a look at:
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.
Raster conversion algorithms for line and circle
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
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
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.
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.
Graphics Output Primitives
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.
Midpoint Circle Algorithm
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
Curves & circles. Write down a possible equation that this could represent y = 6 – 3x or y = -3x + 6.
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.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
+ Equation of a Circle. + Circle A Circle is a set of all points in a plane equidistant from a given point. The Center.
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
Analytic Geometry in Three Dimensions
Scan Conversion or Rasterization
Raster Graphics.
Graphics PRIMITIVES Chapter- 3 & Unit-2.
Lecture 9 Line Drawing Algorithms (Bresenham’s Line Algorithm)
Copyright © Cengage Learning. All rights reserved.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Polygons.
(c) 2002 University of Wisconsin, CS559
Scan Conversion or Rasterization
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Chapter Three Part I Output Primitives CS 380.
Fill Area Algorithms Jan
10.6 Equations of Circles Geometry.
Copyright © Cengage Learning. All rights reserved.
PARTS OF A CIRCLE.
© University of Wisconsin, CS559 Fall 2004
Image Processing, Leture #12
Scan Conversion of Circles
Allah says Say, "Allah created cattle for you. In them you find warmth and benefit and from them you eat. In them there is beauty for you when you bring.
Equation of a Circle.
Scan Conversion Line(DDA Line and Bresenham Line)
1.3 Symmetry; Graphing Key Equations; Circles
Scan Conversion (From geometry to pixels)
Chapter 3 Graphics Output Primitives
Primitive Drawing Algorithm
Finding Basic Shapes Hough Transforms
Type to enter a caption. Computer Graphics Week 2 Lecture 1.
Type to enter a caption. Computer Graphics Week 1 Lecture 2.
Primitive Drawing Algorithm
PARTS OF A CIRCLE.
Line Drawing Algorithms
INTERACTIVE COMPUTER GRAPHICS
Graphing Key Equations
OUTPUT PRIMITIVES / DISPLAY TECHNIQUES
Presentation transcript:

MID-POINT CIRCLE ALGORITHM

Defination The midpoint circle algorithm is an algorithm used to determine the points needed for drawing a circle. At each step, the path is extended by choosing the adjacent pixel which satisfies  but maximizes . We only need to calculate the values on the border of the circle in the first octant. The other values may be determined by symmetry. Assume a circle of radius r with center at (h,k)

The first thing we can notice to make our circle drawing algorithm more efficient is that circles centred at (h,k) have eight-way symmetry Procedure Circle Points(x,y,Integer); Begin Plot(x,y); Plot(y,x); Plot(y,-x); Plot(x,-y); Plot(-x,-y); Plot(-y,-x); Plot(-y,x); Plot(-x,y) End; (x, y) (y, x) (y, -x) (x, -y) (-x, -y) (-y, -x) (-y, x) (-x, y)

fcircle(x,y) < 0 if (x,y) is inside the circle boundary For a point in the interior of the circle, the circle function is negative and for a point outside the circle, the function is positive Thus, fcircle(x,y) < 0 if (x,y) is inside the circle boundary fcircle(x,y) = 0 if (x,y) is on the circle boundary fcircle(x,y) > 0 if (x,y) is outside the circle boundary. X2+y2-r2=0 yk Yk-1 Midpoint between candidate pixels at sampling position xk+1 along a circular path Midpoint xk xk+1 Xk+3

1: Input radius r and circle center (xc,yc) and obtain the first point on the circumference of the circle centered on the origin as (x0,y0) = (0,r) 2: Calculate the initial value of the decision parameter as P0 = 5/4 - r 3: At each xk position starting at k = 0 , perform the following test: If pk < 0 , the next point along the circle centered on (0,0) is (xk+1, yk) and pk+1 = pk + 2xk+1 + 1

Otherwise the next point along the circle is (xk+1, yk-1) and pk+1 = pk + 2xk+1 +1 -2yk+1 Where 2xk+1 = 2xk+2 and 2yk+1 = 2yk-2 4: Determine symmetry points in the other seven octants 5: Move each calculated pixel position (x,y) onto the circular path centered on (x,yc) and plot the coordinate values x = x+ xc , y= y+ yc 6: Repeat steps 3 through 5 until x >= y

Mid-Point Circle Algorithm k Pk xk+1 , yk– 1 2xk+1 2yk+1 -9 (1, 10) 2 20 1 -6 (2, 10) 4 -1 (3, 10) 6 3 (4, 9) 8 18 -3 (5, 9) 10 5 (6, 8) 12 16 (7, 7) 14 A plot of the generated pixel positions in the first quadrant is shown in the figure

The key insights in the mid-point circle algorithm are: Eight-way symmetry can hugely reduce the work in drawing a circle Moving in unit steps along the x axis at each point along the circle’s edge we need to choose between two possible y coordinates

The circles can be drawn with different radius y x y x

Use 8-fold symmetry and only compute pixel positions for the 45° sector. (x, y) (y, x) (-x, y) (y, -x) (x, -y) (-x, -y) (-y, x) (-y, -x)