0% found this document useful (0 votes)
22 views14 pages

DDA PPT

Uploaded by

Mir 69
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)
22 views14 pages

DDA PPT

Uploaded by

Mir 69
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/ 14

1

of
39
Output Primitives
• DDA Line Drawing Algorithm
• Bresenham’s Line Drawing Algorithm
• Midpoint Algorithm for Circle
• Midpoint Algorithm for Ellipse
• Scan line Polygon Fill Method
• Boundary Fill Algorithm
• Flood Fill Algorithm
2
of
39
Pixel
➢ Pixel or Pel is one of the many tiny dots that make
up the representation of a picture in a computer’s
memory.
- pix (picture)
- el (element)
➢ Pixel is a smallest controllable element of a picture
represented on a screen

Prof. Sonal Shroff - TSEC


3
of
39
Pixel
➢ The intensity of each pixel is variable; in color
systems, each pixel has typically three or four
dimensions of variability such as red, green and
blue, or cyan, magenta, yellow and black.
➢ Pixel resolution – pixel count in digital imaging
➢ The convention is to describe the pixel resolution
with the set of two positive integer numbers, where
the first number is the number of pixel columns
(width) and the second is the number of pixel rows
(height), for example as 640 by 480.

Prof. Sonal Shroff - TSEC


4
of
39
DDA Line drawing method
• Digital Differential Analyzer is an
incremental scan conversion method to
determine points on a line
• The slope intercept equation for a straight
line is – y = m.x + c
• m represents slope and c represents Y-
intercept y2 − y1 y = mx
m=
x2 − x1 y
x =
c = y1 − mx1 m
5
of
39
DDA Line drawing method
6
of
39
DDA Line drawing method
• Consider a line with positive slope <=1
y = mx
y
x =
m

• LE as SP RE as SP
xi +1 = xi + 1 xi +1 = xi − 1
yi +1 = yi + m yi +1 = yi − m
7
of
39
DDA Line drawing method
• Consider a line with positive slope > 1
y = mx
y
x =
m

• LE as SP RE as SP
xi +1 = xi + (1 m) xi +1 = xi − (1 m)
yi +1 = yi + 1 yi +1 = yi − 1
8
of
39
DDA Line drawing method
• Consider a line with negative slope |m|<=1
y = mx
y
x =
m

• LE as SP RE as SP
xi +1 = xi + 1 xi +1 = xi − 1
yi +1 = yi − m yi +1 = yi + m
9
of
39
DDA Line drawing method
• Consider a line with negative slope |m| > 1
y = mx
y
x =
m

• LE as SP RE as SP
xi +1 = xi + (1 m) xi +1 = xi − (1 m)
yi +1 = yi − 1 yi +1 = yi + 1
10
of
39
DDA Line drawing method

Line
Positive slope line Negative slope line
Left endpoint as Right endpoint as Left endpoint as Right endpoint as
starting point starting point starting point starting point
m≤1 m>1 m≤1 m>1 |m|≤1 |m|>1 |m|≤1 |m|>1

xi+1= xi+1= xi+1= xi+1= xi+1= xi+1= xi+1= xi+1=


xi+1 xi+1/m xi -1 xi-1/m xi+1 xi+1/m xi -1 xi-1/m
yi+1= yi+1= yi+1= yi+1= yi+1= yi+1= yi+1= yi+1=
yi+m yi+1 yi-m yi-1 yi-m yi-1 yi+m yi+1
11
of
39
DDA Line drawing method
1. Input the end points of a line (x1,y1) and
(x2,y2)
2. Plot the first point (x1,y1)
3. If | x2 - x1| >= | y2 - y1| then
length = | x2 - x1| else
length = | y2 - y1|
4. Calculate dx and dy as
dx = (x2 - x1)/length
dy = (y2 - y1)/length
12
of
39
DDA Line drawing method
5. From i = 1, increment by 1 each time
xi+1 = xi + dx
yi+1 = yi +dy
Plot(round(xi+1) , round(yi+1))
6. Repeat step 5 for length times
13
of
39
DDA Line drawing method
• The DDA algorithm is a better method for
calculating pixel positions than the use of
slope intercept form of equation.
• DDA eliminates the multiplication by
making use of raster characteristics , so
that appropriate increments are applied in
the x or y direction to step to pixel
positions along the line path.
14
of
39
DDA Line drawing method
• The accumulation of round of error in
successive additions of the floating point
increment can cause the calculated pixel
positions to drift away from the true line
path for long line segments.
• DDA is orientation dependent. Hence, end
point accuracy is sometimes not attained
• The rounding operations and floating point
arithmetic in DDA procedure are time
consuming.

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