0% found this document useful (0 votes)
35 views27 pages

Lecture 4 - Output Primitives - Circle

Uploaded by

sanegool55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views27 pages

Lecture 4 - Output Primitives - Circle

Uploaded by

sanegool55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Computer Graphics

Chapter_3

Output Primitives #2

1
Circle-Generating Algorithm

2
 Circles are frequently used in pictures and graphs.

 A procedure for generating either full circles or


circular arcs is included in most graphics packages.

 More generally, a single procedure can be provided to


display either circular or elliptical curves.

 A circle is defined as the set of points that are all at a

given distance r from a center position (xc, yc).


3
4
5
6
 But this is not the best method for generating a circle.

 One problem with this approach is that it involves


considerable computation at each step.

 Moreover, the spacing between plotted pixel positions


is not uniform.

 We could adjust the spacing by interchanging x and y


whenever the absolute value of the slope of the circle
is greater than 1.

 But this simply increases the computation and


7
processing required by the algorithm.
8
9
 This plots pixel positions that are approximately one
unit apart.

 Computation can be reduced by considering the


symmetry of circles.

 The shape of the circle is similar in each quadrant.

 We can generate the circle section in the second


quadrant of the xy plane by noting that the two circle
sections are symmetric with respect to the y axis.

10
11
 And circle sections in the third and fourth quadrants
can be obtained from sections in the first and second
quadrants by considering symmetry about the x axis.

 We can take this one step further and note that there
is also symmetry between octants.

 Circle sections in adjacent octants within one


quadrant are symmetric with respect to the 450 line
dividing the two octants.

12
 These symmetry conditions are illustrated in the
following figure.

 The point at position (x, y) on a one-eighth circle


sector is mapped into the seven circle points in the
other octants of the xy plane.

 Taking advantage of the circle symmetry in this way


we can generate all pixel positions around a circle by
calculating only the points within the sector from:

x = 0 to x = y. 13
14
15
 Determining pixel positions along a circle circumference
using either forms (1) and (2) still requires a good deal
of computation time.

 The Cartesian form (1) involves multiplications and


square root calculations, while the parametric form (2)
contain multiplications and trigonometric calculations.

 More efficient circle algorithms are based on incremental


calculation of decision parameters, as in the Bresenham’s
line drawing algorithm, which involves only simple
integer operations. 16
 Bresenham's line drawing algorithm for raster displays
is adapted to circle generation by setting up decision
parameters for finding the closest pixel to the
circumference at each sampling step.

 The circle equation (1), however, is nonlinear, so that


square-root evaluations would be required to compute
pixel distances from a circular path.

 Bresenham's circle drawing algorithm avoids these


square-root calculations by comparing the squares of
the pixel separation distances. 17
Bresenham's Circle Algorithm

18
19
20
21
22
23
24
25
k pk

0 -9 2 20

1 -6 4 20

2 -1 6 20

3 6 8 18

4 -3 10 18

5 8 12 16

6 5 14 14
26
27

You might also like