Raster Scan Graphics, Line Drawing Algorithm and Circle Drawing Algorithm

721 views 12 slides Apr 08, 2020
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

This presentation contains -
- Characteristics of line drawing algorithm
- DDA Line Drawing Algorithm
- Bresenham's Line Drawing Algorithm
- Circle Drawing Algorithm
- Eight way symmetry of a circle
- Breseham's Circle Drawing Algorithm
- Midpoint Circle Algorithm


Slide Content

Raster Scan Graphics Presented by Asst. Prof. Aparna Joshi

Rasterization The process of determining which pixel will provide the best approximation to the desired line is known as ‘Rasterization ’.

Characteristics of Line Drawing Algorithm The line should appear straight . Displayed line should have constant brightness along their length. The line should be start and end accurately . Lines should have constant density,. Line density should be independent of line length and angle. Lines should be drawn rapidly.

DDA Line Drawing Algorithm 1. Read the line end points (x 1 , y 1 ) & (x 2 , y 2 ) such that they are not equal. (If equal then plot that single point and exit) . 2. Approximate the line length, If absolute (x 2 -x 1 ) >= absolute (y 2 -y1) then length = absolute (x 2 -x 1 ) else length = absolute (y 2 -y 1 ) 3.

DDA Line Drawing Algorithm 4. Using the sign function, make the algorithm work in all quadrant x = x1+0.5 * sign ( ∆x) y = y1 + 0.5 * sign (  y) Here, x1 & y1 are initial values. 5. Begin main loop i = 1 while ( i < = length) { plot (integer (x), Integer (y)) x= x+  x y = y+  y i = i + 1 } end while 6. Finish / Stop

DDA Line Drawing Algorithm Advantages: It is the simplest algorithm & it does not require special skills for implementation. It is a faster method for calculating pixel positions than the direct use of equation y = m.x + b It eliminates the multiplication in the equation by making use of raster characteristics, so that appropriate increments are applied in the x or y direction to find the pixel positions along the line path. It is very easy to understand and implement.   Disadvantages: Floating point arithmetic in DDA algorithm is still time-consuming. The algorithm is orientation dependent. Hence end point accuracy is poor. It drifts away from the actual line path because of rounding off float values into integer.

Bresenham’s Line Drawing Algorithm

Circle Drawing Algorithm

Eight-way Symmetry of a Circle

Bresenham’s Circle Drawing Algorithm

Midpoint Circle Algorithm

Thank You