Lecture 4 Graphic Primitives, Circle. Drawing Circles

Preview:

Citation preview

Lecture 4Graphic Primitives, Circle

Drawing Circles

Brute Force Method

Cheating with 8 arcs

Cheating with 8 arcs Implementation

Cheating with 8 arcs Implementation

Digital Differential Analysis - An incremental algorithm

• Does not require sine or cosine table. • based upon calculating the gradient of a circle at a point

and using that to approximate the position of the next point.

Digital Differential Analysis - An incremental algorithm

Digital Differential Analysis - Implementation

Bresenham’s algorithm for circles• Based on limiting the choice of the next pixel to be plotted

to two alternatives, then creating and testing a decision variable to determine which alternative is actually plotted.

• D(Si) and D(Ti) represent the differences between the squared distance between the center of the circle and the middle of pixels S and T . Whichever is smallest corresponds to the pixel that should be plotted.

• To combine the two calculations into one “decision variable” is simply a matter of subtracting the two expressions:

Bresenham’s algorithm for circles

Implementation for Bresenham’s algorithm

Implementation for circles

Implementation for circles

Implementation for circles

Recommended