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

Computer Graphics

The document discusses computer graphics techniques for scan conversion. It describes the Digital Differential Analyzer (DDA) algorithm for generating lines by calculating incremental slope values between start and end points. Examples show how DDA draws lines by iterating X or Y values based on whether slope is less than, equal to, or greater than 1. Tables show calculated coordinate points along example lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views27 pages

Computer Graphics

The document discusses computer graphics techniques for scan conversion. It describes the Digital Differential Analyzer (DDA) algorithm for generating lines by calculating incremental slope values between start and end points. Examples show how DDA draws lines by iterating X or Y values based on whether slope is less than, equal to, or greater than 1. Tables show calculated coordinate points along example lines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

COMPUTER GRAPHICS

(BCA – 303)
Line: (3,3) to (9,7)

2
Line: (0,0) to (8,4)

8
7
6
5
4
3
2
1
0
0 1 2 3 4 5 6 7 8 9

3
Line: (0,0) to (4,6)

8
7
6
5
4
3
2
1
0
0 1 2 3 4 5 6 7 8 9

4
Scan Conversion Techniques
Find the next PIXEL position on Screen
It used to draw :
1. Line
2. Circle

3. Curve

also called Rasterization


5
Scan Conversion Techniques
Line Generation Algorithms :

1. DDA Line Drawing Algorithm

2. Bresenham’s Line Drawing Algorithm

6
Scan Conversion Techniques
Circle Generation Algorithms :

1. DDA Circle Drawing Algorithm

2. Bresenham’s Circle Drawing Algorithm

3. Mid Point Circle Drawing Algorithm

7
Scan Conversion Techniques
Curve Generation Algorithms :

1. DDA Curve Generation Algorithm

2. Bezier Curve Generation Algorithm

3. B-splin Curve Generation Algorithm

8
DDA Line Drawing Algorithm
(Digital Differential Analyzer)
Step 1: Enter the value of starting point
(X1,Y1) and end point (X2,Y2)

Step 2: Xk=X1 and Yk=Y1

Step 3: Calculate the slope of line i.e. m


m = (Y2-Y1) / (X2-X1)

Step 4: Check value of m

9
DDA Line Drawing Algorithm

Step 5: If m == 1 CASE I

Step 6: for ( Xk=X1; Xk<=X2; Xk++ )


Plot the point Xk and Yk
Yk= Yk+ 1
DDA Line Drawing Algorithm

Step 7: If m < 1 CASE II

Step 8: for ( Xk=X1; Xk<=X2; Xk++ )


Plot the point Xk and (abs) Yk
Yk= Yk + m
DDA Line Drawing Algorithm

Step 9: If m > 1 CASE III

Step 10:for ( Yk=Y1; Yk<=Y2; Yk++ )


Plot the point (abs) Xk and Yk

Xk= Xk + 1/m

Step 11: Exit


Advantage & Disadvantage

Advantage
1. Not Require advance skill
2. Fast method for line generation

Disadvantage
More computation is required in case
of floating point arithmatic operation
Numerical
on
DDA
(Digital Differential Analyzer)

(m<1)
(Digital Differential Analyzer)
Suppose starting coordinates (0,0) and
ending coordinates are (8,4)
Step 1: Enter the value of starting point
(0,0) and end point (8,4)
(X1,Y1) (X2,Y2)
Step 2: Xk=0
Xk=X1 and Yk=Y1
Yk=0

Step 3: Calculate the slope of line i.e. m


m = (Y2-Y1)
(4-0) / (X2-X1)
(8-0) = 0.5

Step 4: Check value of m


(Digital Differential Analyzer)

Step 5: If m == 1 X (NO)
LEAVE STEP 6
(Digital Differential Analyzer)

Step 7: If m < 1 (YES)

Step 8: for ( Xk=0; Xk<=X2; Xk++


Xk=X1; Xk<=8; 1 )

Plot the point 0 0 Yk


Xk and (abs)

Yk= 0
Yk+ +0.5
m
Loop until TRUE
(Digital Differential Analyzer)

Step 9: If m > 1 X (NO)

LEAVE STEP 10

Step 11: Exit


Table for Intermediates coordinate points

X Y (X,Y)
0 0 (0,0)
1 0+0.5 = 0.5 (1,0)
2 0.5 + 0.5 = 1.0 (2,1)
3 1.0 + 0.5 = 1.5 (3,1)
4 1.5 + 0.5 = 2.0 (4,2)
5 2.0 + 0.5 = 2.5 (5,2)
6 2.0 + 0.5 = 3.0 (6,3)
7 3.0 + 0.5 =3.5 (7,3)
8 3.5 + 0.5 = 4.0 (8,4)
Pixel Positions

Line: (0,0) to (8,4)

8
7
6
5
4
3
2
1
0
0 1 2 3 4 5 6 7 8 9
Numerical
on
DDA
(Digital Differential Analyzer)

(m>1)
(Digital Differential Analyzer)
Suppose starting coordinates (0,0) and
ending coordinates are (4,6)
Step 1: Enter the value of starting point
(0,0) and end point (4,6)
(X1,Y1) (X2,Y2)
Step 2: Xk=0
Xk=X1 and Yk=Y1
Yk=0

Step 3: Calculate the slope of line i.e. m


m = (Y2-Y1)
(6-0) / (X2-X1)
(4-0) =1.5

Step 4: Check value of m


(Digital Differential Analyzer)

Step 5: If m == 1 X (NO)
LEAVE STEP 6
(Digital Differential Analyzer)

Step 7: If m < 1 X (NO)

LEAVE STEP 8
(Digital Differential Analyzer)

Step 9: If m > 1 (YES)

Step 10: for ( Yk=0;


Yk=Y1; Yk<=Y2;
Yk<=6; Yk++
1 )

Plot the point (abs)


0 andXk Yk
0

Xk= 0
Xk+ +1/1.5
1/m
Loop until TRUE
Step 11: Exit
Table for Intermediates coordinate points

X Y (X,Y)
0 0 (0,0)
0+0.6 = 0.6 1 (1,1)
0.6 + 0.6 = 1.2 2 (1,2)
1.2 + 0.6 = 1.8 3 (2,3)
1.8 + 0.6 = 2.4 4 (2,4)
2.4 + 0.6 = 3.0 5 (3,5)
3.0 + 0.6 = 3.6 6 (4,6)
Pixel Positions

Line: (0,0) to (4,6)

8
7
6
5
4
3
2
1
0
0 1 2 3 4 5 6 7 8 9

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy