0% found this document useful (0 votes)
15 views15 pages

Lecture 03

This document discusses different topics in computer graphics including scan conversion techniques for lines. It describes the direct use of line equations and the digital differential analyzer (DDA) algorithm for line drawing. The DDA algorithm avoids floating point multiplications but has less accuracy at terminal points. An example demonstrates applying DDA to calculate pixels for a line between two points. The next class will cover Bresenham's line drawing algorithm.

Uploaded by

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

Lecture 03

This document discusses different topics in computer graphics including scan conversion techniques for lines. It describes the direct use of line equations and the digital differential analyzer (DDA) algorithm for line drawing. The DDA algorithm avoids floating point multiplications but has less accuracy at terminal points. An example demonstrates applying DDA to calculate pixels for a line between two points. The next class will cover Bresenham's line drawing algorithm.

Uploaded by

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

COMPUTER GRAPHICS

(BCSPC7010)
7th Semester CSE (R-17)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


SCHOOL OF ENGINEERING AND TECHNOLOGY
GIET UNIVERSITY, GUNUPUR
REVISION : 02
• Cathode Ray Tube (CRT)
• Pixel Scan Conversion

Today
• Scan Conversion of Line
• DDA
Liquid Crystal Display
A LCD is a flat-panel display or other electronically
modulated optical device that uses the light-
modulating properties of liquid crystals combined
with polarizers. Liquid crystals do not emit light
directly, instead using a backlight or reflector to
produce images in color or monochrome.
https://www.xenarc.com/lcd-technology.html
Plasma Display
Plasma Display
A plasma display is a computer video display in which
each pixel on the screen is illuminated by a tiny bit of
plasma or charged gas, somewhat like a tiny neon
light. Plasma displays are thinner than cathode ray
tube ( CRT ) displays and brighter than liquid crystal
displays ( LCD ). Plasma displays are sometimes
marketed as "thin-panel" displays and can be used to
display either analog video signals or display
modes digital computer input..
SCAN CONVERSION OF A LINE
A line in computer
graphics typically refers
to a line segment, which x+b )
y= m (x 2, y 2
is a portion of a straight P2
line that extends b , y )
P 1( x 1
1

indefinitely in opposite
directions.
It is defined by its two end points and the line
equation where m is called Slope and b is y
intercept of the line.
Direct use of the line Equation

If, then for every integer value of x between and


excluding x1 and x2, calculate the corresponding
value of the y using the equation. [OR]
If, then for every integer value of y between y1 and y2,
calculate the corresponding value of the x using the
equation.
 It is a simple and mathematically sound.
 It involves floating point computation (multiplication
and addition) in every step.
Direct use of the line Equation
To identify x is independent variable or y is
independent variable.
X is Independent : y=mx+c
Y is independent : x=(y- c)/m
To determine when which equation will be use.
Example:
Let P=(5, 5) and Q= (20, 15)
Here x distance is 20- 5=15 and y distance is 15-
5=10.
If we use x is independent variable then 15 pixel
will print. If we use y is independent variable then
10 pixel will print. Hence we have to select x is
independent variable for better visibility.
So use the equation y=mx+c
Direct use of the line Equation
Example:
Let P=(5, 5) and Q= (10, 15)
Here x distance is 10- 5=5
and y distance is 15- 5=10.
If we use x is independent variable then 5 pixel
will print. If we use y is independent variable
then 10 pixel will print. Hence we have to
select y is independent variable for better
visibility.
So use the equation x=(y- c)/m
DDA (DIGITAL DIFFERENTIAL ANALYZER)

Line equation:
At a point
If slope
Let next point of p(x1, y1) is P(x2, y2)
DDA (DIGITAL DIFFERENTIAL ANALYZER)
DDA(x1, y1, x2, y2)
{
dx= abs(x2-x1);
dy= abs(y2-y1);
if(dy>=dx)
L=dy
else
L=dx
∆y=(y2-y1)/L
∆ x=(x2-x1)/L
i=1,x=x1,y=y1;
while(i<=L)
{ putpixel(round(x), round(y),2);
x=x+ ∆ x;
y=y+ ∆ y;
i=i+1 }
}
DDA (DIGITAL DIFFERENTIAL ANALYZER)

Advantage of DDA:
 Easy to Implement.

 It is avoided floating point multiplication.

Disadvantage of DDA:
 Poor accuracy at the terminal point.

 Still floating point addition is there.


DDA (DIGITAL DIFFERENTIAL ANALYZER)
Problem 01:
Consider a line AB with A(5,5) and B(10,9). Apply a
simple DDA algorithm and calculate the pixel on the
line.
Solution:
Step 1:
Step 2:

Step 3:
Step 4:

Step 5:
DDA (DIGITAL DIFFERENTIAL ANALYZER)

10
i Xnew Ynew X Y
9
5.5 5.5 5 5
8
1 6.5 6.3 6 6
7
2 7.5 7.1 7 7
6
3 8.5 7.9 8 7
5
4 9.5 8.7 9 8 4
5 10.5 9.5 10 9 3
2
1

1 2 3 4 5 6 7 8 9 10
REVISION : 02
• Scan Conversion of Line
• DDA Algorithm for Line Drawing

NEXT CLASS
• Bresenham’s line drawing algorithm

You might also like