SlideShare a Scribd company logo
Scan Converting a Circle
 A circle is a symmetrical figure. Any
circle-generating algorithm can
take advantage of the circle's
 symmetry to plot eight points for
each value that the algorithm
calculates. Eight-way symmetry is
used by
 reflecting each calculated point
around each 45° axis. For example,
if point 1 in Fig. 3-4 were calculated
 with a circle algorithm, seven more
points could be found by
reflection.
Defining a Circle
 There are two standard methods of mathematically defining a circle
centered at the origin. The first method defines a circle with the
second-order polynomial equation
y2=r2-x2
where x = the x coordinate
y = the y coordinate
r = the circle radius
 With this method, each x coordinate in the sector from 90° to 45°, is
found by stepping x from 0 to
r/sqrt(2), and each y coordinate is found by evaluating sqrt(r2 — x2) for
each step of x.
 This is a very inefficient method, however, because for each point
both x and r must be squared and subtracted from each other; then
the square root of the result must be found.
Defining a Circle
 The second method of defining a circle
makes use of trigonometric functions (see Fig.
3-6):
 x = r cos y = r sin
ɵ ɵ
 where = current angle
ɵ
 r = circle radius
 x = x coordinate
 y = y coordinate
 By this method, is stepped from to
ɵ ɵ Π/4,
and each value of x and y is calculated.
However, computation of the values of sin ɵ
and cos is even more time-consuming than
ɵ
the calculations required by the first method.
Generating a circle using
Polynomial Method
1. Set the initial variables: r = circle radius; (h, k) = coordinates of the circle center; x =
0; i = step size;
2. Test to determine whether the entire circle has been scan-converted. If x > xend, stop.
3. Compute the value of the y coordinate, where y = sqrt(r2
— x2
).
4. Plot the eight points, found by symmetry with respect to the center (h, k), at the
current (x, y) coordinates:
Plot(x + h, y + k) Plot(-x + h, -y + k)
Plot(y + h, x + k) Plot(-y + h, -x + k)
Plot(-y + h, x + k) Plot(y + h, -x + k)
Plot(-x + h, y + k) Plot(x + h, -y + k)
5. Increment x: x = x + i.
6. Go to step 2.
Scan Convert a Circle using
Trigonometric Method
1. Set the initial variables: r = circle radius; (h, k) = coordinates of the circle center; i = step size;
ɵend = Π/4 (radians = 45°); = 0.
ɵ
2. Test to determine whether the entire circle has been scan-converted. If >
ɵ ɵend , stop.
3. Compute the value of the x and y coordinates:
x = r cos( ) y = r sin( )
ɵ ɵ
4. Plot the eight points, found by symmetry with respect to the center (h, k), at the current (x, y)
coordinates:
Plot(x + h, y + k) Plot(-x + h, -y + k)
Plot(y + h,x + k) Plot(-y + h, -x + k)
Plot(-y + h, x + k) Plot(y + h,-x + k)
Plot(-x + h, y + k) Plot(x + h, -y + k)
5. Increment : = + i.
ɵ ɵ
6. Go to step 2.
Bresenham's Circle Algorithm
 Scan-converting a circle using
Bresenham's algorithm works as follows.
 The best approximation of the true circle
will be described by those pixels in the
raster that fall the least distance from the
true circle. Examine Fig. 3-8. Notice that, if
points are generated from 90° and
45°,each new point closest to the true
circle can be found by taking either of two
actions:
(1) move in the x direction one unit or
(2) move in the x direction one unit and
move in the negative y direction one unit.
Therefore, a method of selecting between
these two choices is all that is necessary to
find the points closest to the true circle.
Bresenham's Circle Algorithm
 Assume that (xi,yi) are the coordinates of the last scan-
converted pixel upon entering step i.
 Let the distance from the origin to pixel T squared minus
the distance to the true circle squared = D(T). Then let the
distance from the origin to pixel S squared minus the
distance to the true circle squared = D(S). As the
coordinates of T are (xi + 1,yi) and those of S are (xi + 1,yi-
1), the following expressions can be developed:
 This function D provides a relative measurement of the
distance from the center of a pixel to the true circle.
Since D(T) will always be positive (T is outside the true
circle) and D(S) will always be negative (S is inside the true
circle), a decision variable di may be defined as follows:
 When di < 0, we have |D(T)| < |D(S)| and pixel T is
chosen. When di > 0, we have |D(T)| > |D(S)| and pixel S
is selected.
Bresenham's Circle Algorithm
1. Set the initial values of the variables: (h, k) = coordinates of circle center; x = 0; y =
circle radius r and d = 3 - 2r.
2. Test to determine whether the entire circle has been scan-converted. If x > y, stop.
3. Plot the eight points, found by symmetry with respect to the center (h, k), at the
current (x, y) coordinates:
Plot(x + h, y + k) Plot(-x + h, -y + k)
Plot(y + h, x + k) Plot(-y + h, -x + k)
Plot(-y + h, x + k) Plot(y + h,-x + k)
Plot(-x + h, y + k) Plot(x + h, -y + k)
4. Compute the location of the next pixel.
If d < 0, then d = d + 4x + 6 and x = x + 1.
If d > 0, then d = d + 4(x - y) + 10, x = x + 1, and y = y - 1.
5. Go to step 2.
Defining an Ellipse using Polynomial Method
 The ellipse, like the circle, shows symmetry. In the case of an
ellipse, however, symmetry is four- rather than eight-way.
 There are two methods of mathematically defining a ellipse.
 The polynomial method of defining an ellipse (Fig. 3-9) is given by
the expression
 where (h, k) = ellipse center
 a = length of major axis
 b = length of minor axis
When the polynomial method is used to define an ellipse, the value
of x is incremented from h to a. For each step of x, each value of y is
found by evaluating the expression
 This method is very inefficient, however, because the squares of a
and (x — h) must be found; then floating- point division of (x — h)
by a2 and floating-point multiplication of the square root of [1 —
(x — h) /a2] by b must be performed
Scan Converting an Ellipse using
Polynomial Method
1. Set the initial variables: a = length of major axis; b = length of minor axis; (h,
k) = coordinates of ellipse center; x = 0; i = step size; xend = a.
2. Test to determine whether the entire ellipse has been scan-converted. If x >
xend, stop.
3. Compute the value of the y coordinate:
4. Plot the four points, found by symmetry, at the current (x, y) coordinates:
Plot(x + h, y + k) Plot(-x + h, -y + k)
Plot(-x + h, y + k) Plot(x + h, -y + k)
5. Increment x: x = x + i.
6. Go to step 2.
Defining Ellipse using Trigonometric
Method
A second method of defining an ellipse makes use of trigonometric
relationships. The following equations define an ellipse trigonometrically:
x = a cos(ɵ) + h and y = b sin(ɵ) + k
 where (x, y) = the current coordinates
 a = length of major axis
 b = length of minor axis
 ɵ = current angle
 (h,k) = ellipse center
For generation of an ellipse using the trigonometric method, the value
of ɵ is varied from 0 to n/2
radians (rad). The remaining points are found by symmetry.
While this method is also inefficient and thus generally too slow for
interactive applications, a lookup table containing the values for sin(ɵ)
and cos(ɵ) with ɵ ranging from 0 to n/2 rad can be used.
Scan Converting an Ellipse using
Trigonometric Method
1. Set the initial variables: a = length of major axis; b = length of minor axis; (h,
k) = coordinates of ellipse center; i = counter step size; ɵend = n/2; ɵ = 0.
2. Test to determine whether the entire ellipse has been scan-converted. If ɵ >
ɵend, stop.
3. Compute the values of the x and y coordinates:
x = a cos(ɵ) y = b sin(ɵ)
4. Plot the four points, found by symmetry, at the current (x, y) coordinates:
Plot(x + h, y + k) Plot(-x + h, -y + k)
Plot(-x + h, y + k) Plot(x + h, -y + k)
5. Increment 8: 8 = 8 + i.
6. Go to step 2

More Related Content

PPT
Circle drawing algo.
PPTX
L-6 (Circle Drawing Algorithm Computer graphics).pptx
PPT
Ellipses drawing algo.
PPTX
Lec05 circle ellipse
PPT
Shape drawing algs
PPTX
A mid point ellipse drawing algorithm on a hexagonal grid
PPTX
Output primitives in Computer Graphics
PPT
Curves
Circle drawing algo.
L-6 (Circle Drawing Algorithm Computer graphics).pptx
Ellipses drawing algo.
Lec05 circle ellipse
Shape drawing algs
A mid point ellipse drawing algorithm on a hexagonal grid
Output primitives in Computer Graphics
Curves

Similar to Breshnam's circle drawing algorithm.pptx (20)

PPT
PPT
Lines and curves algorithms
PPT
Unit 1 engineering curves
PPT
Unit 1 engineering curves
PPTX
Conic sections
PPS
Curves1(thedirectdata.com)
PPT
Geometry unit 12.5
PPT
Edp curve1
PDF
Lect4 ellipse
PPT
Curve 1
PPT
2- using drawing tools in Graphic and geometric graphics engineering.
PDF
International Journal of Computational Engineering Research(IJCER)
PPTX
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
PPTX
Modified EG FULL PORTION PPT 2020 (1).pptx
PPT
Engineering Curves
PPT
Computer_Graphics_circle_drawing_techniq.ppt
PPT
10994479.ppt
PPT
PPTX
Bressenham’s Midpoint Circle Drawing Algorithm
Lines and curves algorithms
Unit 1 engineering curves
Unit 1 engineering curves
Conic sections
Curves1(thedirectdata.com)
Geometry unit 12.5
Edp curve1
Lect4 ellipse
Curve 1
2- using drawing tools in Graphic and geometric graphics engineering.
International Journal of Computational Engineering Research(IJCER)
Computer Graphics - Bresenham's line drawing algorithm & Mid Point Circle alg...
Modified EG FULL PORTION PPT 2020 (1).pptx
Engineering Curves
Computer_Graphics_circle_drawing_techniq.ppt
10994479.ppt
Bressenham’s Midpoint Circle Drawing Algorithm
Ad

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Institutional Correction lecture only . . .
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Cell Types and Its function , kingdom of life
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Computing-Curriculum for Schools in Ghana
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Complications of Minimal Access Surgery at WLH
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Institutional Correction lecture only . . .
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Basic Mud Logging Guide for educational purpose
Cell Types and Its function , kingdom of life
PPH.pptx obstetrics and gynecology in nursing
Computing-Curriculum for Schools in Ghana
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
VCE English Exam - Section C Student Revision Booklet
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pharma ospi slides which help in ospi learning
Microbial diseases, their pathogenesis and prophylaxis
Final Presentation General Medicine 03-08-2024.pptx
Complications of Minimal Access Surgery at WLH
GDM (1) (1).pptx small presentation for students
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Anesthesia in Laparoscopic Surgery in India
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Ad

Breshnam's circle drawing algorithm.pptx

  • 1. Scan Converting a Circle  A circle is a symmetrical figure. Any circle-generating algorithm can take advantage of the circle's  symmetry to plot eight points for each value that the algorithm calculates. Eight-way symmetry is used by  reflecting each calculated point around each 45° axis. For example, if point 1 in Fig. 3-4 were calculated  with a circle algorithm, seven more points could be found by reflection.
  • 2. Defining a Circle  There are two standard methods of mathematically defining a circle centered at the origin. The first method defines a circle with the second-order polynomial equation y2=r2-x2 where x = the x coordinate y = the y coordinate r = the circle radius  With this method, each x coordinate in the sector from 90° to 45°, is found by stepping x from 0 to r/sqrt(2), and each y coordinate is found by evaluating sqrt(r2 — x2) for each step of x.  This is a very inefficient method, however, because for each point both x and r must be squared and subtracted from each other; then the square root of the result must be found.
  • 3. Defining a Circle  The second method of defining a circle makes use of trigonometric functions (see Fig. 3-6):  x = r cos y = r sin ɵ ɵ  where = current angle ɵ  r = circle radius  x = x coordinate  y = y coordinate  By this method, is stepped from to ɵ ɵ Π/4, and each value of x and y is calculated. However, computation of the values of sin ɵ and cos is even more time-consuming than ɵ the calculations required by the first method.
  • 4. Generating a circle using Polynomial Method 1. Set the initial variables: r = circle radius; (h, k) = coordinates of the circle center; x = 0; i = step size; 2. Test to determine whether the entire circle has been scan-converted. If x > xend, stop. 3. Compute the value of the y coordinate, where y = sqrt(r2 — x2 ). 4. Plot the eight points, found by symmetry with respect to the center (h, k), at the current (x, y) coordinates: Plot(x + h, y + k) Plot(-x + h, -y + k) Plot(y + h, x + k) Plot(-y + h, -x + k) Plot(-y + h, x + k) Plot(y + h, -x + k) Plot(-x + h, y + k) Plot(x + h, -y + k) 5. Increment x: x = x + i. 6. Go to step 2.
  • 5. Scan Convert a Circle using Trigonometric Method 1. Set the initial variables: r = circle radius; (h, k) = coordinates of the circle center; i = step size; ɵend = Π/4 (radians = 45°); = 0. ɵ 2. Test to determine whether the entire circle has been scan-converted. If > ɵ ɵend , stop. 3. Compute the value of the x and y coordinates: x = r cos( ) y = r sin( ) ɵ ɵ 4. Plot the eight points, found by symmetry with respect to the center (h, k), at the current (x, y) coordinates: Plot(x + h, y + k) Plot(-x + h, -y + k) Plot(y + h,x + k) Plot(-y + h, -x + k) Plot(-y + h, x + k) Plot(y + h,-x + k) Plot(-x + h, y + k) Plot(x + h, -y + k) 5. Increment : = + i. ɵ ɵ 6. Go to step 2.
  • 6. Bresenham's Circle Algorithm  Scan-converting a circle using Bresenham's algorithm works as follows.  The best approximation of the true circle will be described by those pixels in the raster that fall the least distance from the true circle. Examine Fig. 3-8. Notice that, if points are generated from 90° and 45°,each new point closest to the true circle can be found by taking either of two actions: (1) move in the x direction one unit or (2) move in the x direction one unit and move in the negative y direction one unit. Therefore, a method of selecting between these two choices is all that is necessary to find the points closest to the true circle.
  • 7. Bresenham's Circle Algorithm  Assume that (xi,yi) are the coordinates of the last scan- converted pixel upon entering step i.  Let the distance from the origin to pixel T squared minus the distance to the true circle squared = D(T). Then let the distance from the origin to pixel S squared minus the distance to the true circle squared = D(S). As the coordinates of T are (xi + 1,yi) and those of S are (xi + 1,yi- 1), the following expressions can be developed:  This function D provides a relative measurement of the distance from the center of a pixel to the true circle. Since D(T) will always be positive (T is outside the true circle) and D(S) will always be negative (S is inside the true circle), a decision variable di may be defined as follows:  When di < 0, we have |D(T)| < |D(S)| and pixel T is chosen. When di > 0, we have |D(T)| > |D(S)| and pixel S is selected.
  • 8. Bresenham's Circle Algorithm 1. Set the initial values of the variables: (h, k) = coordinates of circle center; x = 0; y = circle radius r and d = 3 - 2r. 2. Test to determine whether the entire circle has been scan-converted. If x > y, stop. 3. Plot the eight points, found by symmetry with respect to the center (h, k), at the current (x, y) coordinates: Plot(x + h, y + k) Plot(-x + h, -y + k) Plot(y + h, x + k) Plot(-y + h, -x + k) Plot(-y + h, x + k) Plot(y + h,-x + k) Plot(-x + h, y + k) Plot(x + h, -y + k) 4. Compute the location of the next pixel. If d < 0, then d = d + 4x + 6 and x = x + 1. If d > 0, then d = d + 4(x - y) + 10, x = x + 1, and y = y - 1. 5. Go to step 2.
  • 9. Defining an Ellipse using Polynomial Method  The ellipse, like the circle, shows symmetry. In the case of an ellipse, however, symmetry is four- rather than eight-way.  There are two methods of mathematically defining a ellipse.  The polynomial method of defining an ellipse (Fig. 3-9) is given by the expression  where (h, k) = ellipse center  a = length of major axis  b = length of minor axis When the polynomial method is used to define an ellipse, the value of x is incremented from h to a. For each step of x, each value of y is found by evaluating the expression  This method is very inefficient, however, because the squares of a and (x — h) must be found; then floating- point division of (x — h) by a2 and floating-point multiplication of the square root of [1 — (x — h) /a2] by b must be performed
  • 10. Scan Converting an Ellipse using Polynomial Method 1. Set the initial variables: a = length of major axis; b = length of minor axis; (h, k) = coordinates of ellipse center; x = 0; i = step size; xend = a. 2. Test to determine whether the entire ellipse has been scan-converted. If x > xend, stop. 3. Compute the value of the y coordinate: 4. Plot the four points, found by symmetry, at the current (x, y) coordinates: Plot(x + h, y + k) Plot(-x + h, -y + k) Plot(-x + h, y + k) Plot(x + h, -y + k) 5. Increment x: x = x + i. 6. Go to step 2.
  • 11. Defining Ellipse using Trigonometric Method A second method of defining an ellipse makes use of trigonometric relationships. The following equations define an ellipse trigonometrically: x = a cos(ɵ) + h and y = b sin(ɵ) + k  where (x, y) = the current coordinates  a = length of major axis  b = length of minor axis  ɵ = current angle  (h,k) = ellipse center For generation of an ellipse using the trigonometric method, the value of ɵ is varied from 0 to n/2 radians (rad). The remaining points are found by symmetry. While this method is also inefficient and thus generally too slow for interactive applications, a lookup table containing the values for sin(ɵ) and cos(ɵ) with ɵ ranging from 0 to n/2 rad can be used.
  • 12. Scan Converting an Ellipse using Trigonometric Method 1. Set the initial variables: a = length of major axis; b = length of minor axis; (h, k) = coordinates of ellipse center; i = counter step size; ɵend = n/2; ɵ = 0. 2. Test to determine whether the entire ellipse has been scan-converted. If ɵ > ɵend, stop. 3. Compute the values of the x and y coordinates: x = a cos(ɵ) y = b sin(ɵ) 4. Plot the four points, found by symmetry, at the current (x, y) coordinates: Plot(x + h, y + k) Plot(-x + h, -y + k) Plot(-x + h, y + k) Plot(x + h, -y + k) 5. Increment 8: 8 = 8 + i. 6. Go to step 2