November 18, 20151. 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.

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:
PARAMETRIC EQUATIONS AND POLAR COORDINATES
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.
Larry F. Hodges (modified by Amos Johnson) 1 Design of Line, Circle & Ellipse Algorithms.
Polar Coordinate System 11.3 – Polar Coordinates Used to plot and analyze equations of conics (circles, parabolas, ellipses, and hyperbolas. Another method.
14 Trigonometry (1) Case Study 14.1 Introduction to Trigonometry
Polar Coordinates Objective: To look at a different way to plot points and create a graph.
Copyright © Cengage Learning. All rights reserved.
Graphs Chapter 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA A A AAA A.
2D Output Primitives Graphics packages provide basic operations (called primitive operations) to describe a scene in terms of geometric structures. The.
Raster conversion algorithms for line and circle
Section 1.1 The Distance and Midpoint Formulas. x axis y axis origin Rectangular or Cartesian Coordinate System.
Terminal Arm Length and Special Case Triangles DAY 2.
Circle Drawing algo..
Integration in polar coordinates involves finding not the area underneath a curve but, rather, the area of a sector bounded by a curve. Consider the region.
LIAL HORNSBY SCHNEIDER
POLAR COORDINATES (Ch )
Copyright © Cengage Learning. All rights reserved. 10 Parametric Equations and Polar Coordinates.
1 © 2011 Pearson Education, Inc. All rights reserved 1 © 2010 Pearson Education, Inc. All rights reserved © 2011 Pearson Education, Inc. All rights reserved.
6.3 Polar Coordinates Day One
10.4A Polar Equations Rectangular: P (x, y) Polar: P (r,  )  r = radius (distance from origin)   = angle (radians)
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.
Dr. S.M. Malaek Assistant: M. Younesi
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.
Distance and Midpoint Graphing, Symmetry, Circles Solving.
LINE REFLECTIONS Review Mrs. Erickson The Coordinate Axes x-axis y-axis Origin: (0,0) (x,y)
coordinates, lines and increment
Midpoint and Distance in the Coordinate Plane.   Students will be able to…  Develop and apply the formula for midpoint.  Use the distance formula.
GRE: Graphical Representations COORDINATE GEOMETRY.
Slide 8- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Larry F. Hodges 1 Design of Line and Circle Algorithms.
Slide 5- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Chapter 1-The Basics Calculus, 2ed, by Blank & Krantz, Copyright 2011 by John Wiley & Sons, Inc, All Rights Reserved.
1 Circle Drawing Algorithms Pictures snagged from
Graphics Output Primitives
1.3 Symmetry; Graphing Key Equations; Circles
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
Sullivan Algebra and Trigonometry: Section 10.2 Objectives of this Section Graph and Identify Polar Equations by Converting to Rectangular Coordinates.
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.
Polar Equations M 140 Precalculus V. J. Motto. Graphing Polar Equations It is expected that you will be using a calculator to sketch a polar graph. Before.
Week 4 Functions and Graphs. Objectives At the end of this session, you will be able to: Define and compute slope of a line. Write the point-slope equation.
Slide 1- 1 Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Instructor: Dr. Shereen Aly Taie If (P>0)
SAT II - Math Level 2 Test #03 Solution. 1.If the graph of 3x + y + 5 = 0 is perpendicular to the graph of ax – 2y + 9 = 0, then a equals (A) 3/2 (B)
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.
WARM UP Convert from radians to degrees to radians or radians to degrees. 1.π/ ° 4.45° 5.Name the trigonometric functions. 60° -(450/π) ≈
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
Primitive graphic objects
Scan Conversion or Rasterization
MID-POINT CIRCLE ALGORITHM
CS G140 Graduate Computer Graphics
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 Circles
Chapter 3 Graphics Output Primitives
Presentation transcript:

November 18, 20151

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 is: where r is the radius of the circle OR November 18, 20152

Let r = 20 November 18, x 0 = 0

However, unsurprisingly this is not a brilliant solution! Firstly, the resulting circle has large gaps where the slope approaches the vertical Secondly, the calculations are not very efficient The square (multiply) operations The square root operation – try really hard to avoid these! We need a more efficient, more accurate solution November 18, 20154

Parametric polar representation x = r. cos (ө) y = r. sin (ө) x = x c + r. cos (ө) y = y c + r. sin (ө) OR Arc Length x1 = r. cos (ө) x2 = r. cos (ө + dө) y1 = r. sin (ө) y2 = r. sin (ө + dө) dө: is a fixed angular step size November 18, 20155

x 2 = x 1. cos (dө) – y 1. sin (dө) y 2 = y 1. cos (dө) + x 1. sin (dө) By using trigonometry... get dtheta = 1/r ; cdetheta = cos (dtheta) ; sdetheta = sin (detheta) ; x = 0 ; y = r ; while (x<=y){ Plotpixel (x, y) ; // for eight points xtemp = x ; x = x * cdetheta – y * sdetheta ; y = y * cdetheta + xtemp * sdetheta ; } November 18, Help for programming

Bresenham’s algorithm for circles Key idea: compute the initial octant only Generate first octant 1 Reflect first octant about y=x 2 Reflect first quadrant about x=0 3 Reflect upper semicircle about y=0 4

Bresenham’s incremental circle algorithm Example: circle of radius 8 Bright pixels: initial pixel (0,8) (1,8) (2,8) (3,7) (4,7) (5,6) (6,5) (7,4) (7,3) (8,2) (8,1) end pixel (8,0) November 18, 20158

9

Eight-Way Symmetry The first thing we can notice to make our circle drawing algorithm more efficient is that circles centred at (0, 0) have eight-way symmetry November 18,

Mid-Point Circle Algorithm Similarly to the case with lines, there is an incremental algorithm for drawing circles – the mid-point circle algorithm In the mid-point circle algorithm we use eight-way symmetry so only ever calculate the points for the top right eighth of a circle, and then use symmetry to get the rest of the points Assume that we have just plotted point (x k, y k ) The next point is a choice between (x k +1, y k ) and (x k +1, y k -1) We would like to choose the point that is nearest to the actual circle So how do we make this choice? November 18,

November 18, Note: When x-axis increased by one unit, then the y-axis either increased by one or not

Assuming we have just plotted the pixel at ( x k,y k ) so we need to choose between ( x k +1,y k ) ( A), or ( x k +1,y k -1 ) (B)... By comparing distance between points and the real circle line. dA = (x k + 1) 2 + y k 2 – r 2 dB = (x k + 1) 2 + (y k -1) 2 – r 2 Now check the point with smallest distance, by checking the sum of (dA, and dB) S = dA + dB What are the probabilities of S value? November 18,

1. Line between A and B dA > 0 and dB < 0 If abs (dA) > abs (dB) S >0 choose B If abs (dA) <= abs (dB) S<= 0 choose A 2. If the circle line pass through or up of A dA <= 0 and dB < 0 S < 0 choose A 3. If the circle line pass through or under the point B dA > 0 and dB >= 0 S > 0 choose B November 18,

RULE If S >0 choose pixel B Else choose A November 18,

Ellipses x = a. cos (ө) OR x = x c + a. cos (ө) y = b. sin(ө) OR y = y c + b. sin(ө) November 18,

To draw ellipse : 1.The ellipse has four points symmetry 2.Increment angle with very small value (dө) 3.Find (x2, y2) from point (x1, y1) 4.Find (x2, y2) according to the following equations x2 = x1. cos (dө) – (a/b). y1. sin (dө) y2 = y1. cos (dө) + (b/a). x1. sin (dө) The start point will be (0, a) Ending of loop when x = b November 18,

Home work / draw the following figure November 18,

Home work / draw the following figure November 18,