0% found this document useful (0 votes)
91 views32 pages

Presentation On Line Drawing Algorithms

This presentation provides an overview of various line drawing algorithms. It discusses direct scan conversion, the digital differential analyzer (DDA), Bresenham's algorithm, circle drawing algorithms that take advantage of symmetry, and ellipse generating algorithms. It also covers character generation techniques, including the stroke method, vector/bitmap method, and starburst method. The goal is to generate visually satisfactory images using minimal computations.

Uploaded by

Musariri Talent
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)
91 views32 pages

Presentation On Line Drawing Algorithms

This presentation provides an overview of various line drawing algorithms. It discusses direct scan conversion, the digital differential analyzer (DDA), Bresenham's algorithm, circle drawing algorithms that take advantage of symmetry, and ellipse generating algorithms. It also covers character generation techniques, including the stroke method, vector/bitmap method, and starburst method. The goal is to generate visually satisfactory images using minimal computations.

Uploaded by

Musariri Talent
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/ 32

PRESENTATION ON LINE

DRAWING ALGORITHMS
BY;
DAISON DUCHE
LEE TERERAI GOMBE
TENDAI MAPIKU
INTRODUCTION

 Several line drawing algorithms are developed. Their basic objective is to


enable visually satisfactory images in least possible time. This is achieved by
reducing the calculations to a minimum.
 This is by using integer arithmetic rather than floating point arithmetic. This
way of minimizing even a single arithmetic operation is important. This is
because every drawing or image generated will have a large number of line
segments in it and every line segment will have many pixels.
 So saving of one computation per pixel will save number of computations in
generating an object. This in turn minimizes the time required to generate
the whole image on the screen.
AIM

 The aim of this presentation is to give you an overview and insight into line
drawing algorithms.
SCOPE

 DEFINITIONS
 DIRECT SCAN CONVERSION
 DIGITAL DIFFERETIAL ANALYZER (DDA)
 BRESENHAM’S ALGORITHM
 CIRCLE DRAWING
 ELLIPSE-GENERATING ALGORITHMS
 CHARACTER GENERATION TECHNIQUE
DIRECT SCAN
CONVERSION
DIGITAL DIFFERETIAL
ANALYZER (DDA)
BRESENHAM’S
ALGORITHM
CIRCLE DRAWING
We know that the equation of a circle centered at the origin is x2 + y2 = R 2 ,
where (0, 0) is the origin R is the radius and (x, y) is any point on the circle.

x 2 + y2 = R2
y 2 = R2 – x 2
y = + √ (R 2 – x 2 )

To draw a quarter circle, we can increment x from 0 to R in unit steps, solving for
+y at each step. This method will work, but it is inefficient because of the multiply
and square root operations. Here the circle will have large gaps for values of x close
to R, because the slope of the circle becomes infinite there.

Eight-way symmetry

We can improve the process of the previous section by taking greater advantage of
the symmetry in a circle. Consider first a circle centered at the origin.
That is (0, 0). If the point (x, y) is on the circle the new
can trivially compute seven other points on the circle as
in a fig below;

Eight symmetrical points on a circle) We need to


compute only one 45-degree segment to determine the
circle completely. For a circle centered at the origin
(0,0), the eight symmetrical points can be displayed with
procedure circlepoints().
Void circlepoints (int x, int y)
{
putpixel ( x, y);
putpixel ( y, x);
putpixel ( y, -x);
putpixel ( x, -y);
putpixel ( -x, -y);
putpixel ( -y, -x);
putpixel ( -y, x);
putpixel ( -x, y);
}
This procedure can be easily generalized to the case of circles
with arbitrary centers. Suppose the point (xcenter, ycenter) is
the center of the circle. Then the above function can be
modified as

Void circlepoints(xcenter, ycenter, x, y) intxcenter, ycenter, x,


y;
{
putpixel ( xcenter + x, ycenter + y);
putpixel ( xcenter + y, ycenter + x);
putpixel ( xcenter + y, ycenter - x);
putpixel ( xcenter + x, ycenter - y);
putpixel ( xcenter - x, ycenter - y);
putpixel ( xcenter - y, ycenter - x);
putpixel ( xcenter -y, ycenter + x);
putpixel ( xcenter - x, ycenter + y);
}
ELLIPSE-GENERATING
ALGORITHMS
Loosely stated, an ellipse is an elongated circle. Therefore, elliptical curves can be
generated by modifying circle-drawing procedures to take into account the different
dimensions of an ellipse along the major and minor axes.

Properties of Ellipses
An ellipse is defined as the set of points such that the sum of the distances from two
fixed positions (foci) is the same for all points (Fig. 1.40). If the distances to the two
foci from any point P = (x, y) on the ellipse are labeled dland d2, then the general
equation of an ellipse can be stated as

d1+ d2= constant

Expressing distances d1and d2interms of the focal coordinates F1 = (x1, y1)and F2=
(x2,y2), we have

√((x-x1) 2 +(y-y1) 2 ) + √((x-x2) 2 +(y-y2) 2 )=constant A

By squaring this equation, isolating the remaining radical, and then squaring again,
we can rewrite the general ellipseequation in the form

Ax2 + By2 + Cxy+ Dx+ Ey+ F = 0 B


Where the coefficients A, B, C, D, E, and F are evaluated in terms of the focal coordinates and the
dimensions of the major and minor axes of the ellipse. The major axis is the straight line segment extending
from one side of the ellipse to the other through the foci. The minor axis spans the shorter dimension of the
ellipse, bisecting the major axis at the halfway position (ellipse center) between the two foci.

An interactive method for specifying an ellipse in an arbitrary orientation is to input the two foci and a point
on the ellipse boundary. With these three coordinate positions, we can evaluate the constant in A. Then, the
coefficients in B can be evaluated and used to generate pixels along the elliptical path.

Ellipse equations are greatly simplified if the major and minor axes are oriented to align with the coordinate
axes. In Fig.1:41, we show an ellipse in "standard position" with major and minor axes oriented parallel to the
x and y axes. Parameter rx for this example labels the semi major axis, and parameter ry labels the semi
minor axis. The equation of the ellipse shown in Fig.1:42 can be written in terms of the ellipse center
coordinates and parameters rx and ry as

((x-xc)/rx) 2 +((y-yc)/ry) 2 =1 C

Using polar coordinates r and θ,we can also describe the ellipse in standard position with the parametric
equations:

x= xc+rxcosθ y= yc+rysinθ

Symmetry considerations can be used to further reduce computations. An ellipse in standard position is
symmetric between quadrants, but unlike a circle, it is not symmetric between the two octants of a
quadrant. Thus, we must calculate pixel positions along the elliptical arc throughout one quadrant, and then
we obtain positionsin the remaining three quadrants by symmetry
CHARACTER
GENERATION
TECHNIQUE
 In computer graphics character can be generated using software.
 In hardware implementation of character generation limited faces of
character can be generated.
 A wide variety of faces of character can be generated with software
implementation.
 There are three methods for generating characters using software
implementation:-
• Stroke method
• Vector method or bitmap method.
• Star bust method applications
 Stroke Method
In this method we use a sequence of line drawing function and arc functions to
generate characters.
We can generate a sequence of character by assigning starting and end point of
line or arc.
By using this method various faces of character can be generated by changing the
values (parameters) in line and arc function.
 Starbust Method
In this method a fixed pattern of line is used to generate the character.
In this method we use a combination of 24 bit line segment.
In 24 bit line segment code each bit represent a single line.
To highlight a line we put corresponding bit 1 in 24 bit line segment code and 0
otherwise.
 Representation of Starbust Method:
Bitmap Method
This method is suitable for producing various character.
Font size of character can be increased by increasing the size of array.
This method uses an array of 1’s & 0’s to represent pixels
 Example of an Bitmap Array:
 Disadvantages
All the mentioned methods creates aliased characters:
In Starbust method, 24 bit segment code is required to put in memory for generating character.
Hence extra memory is required in this method .
Character quality is poor due to limited face.
THE END
DISCUSSION

You might also like