0% found this document useful (0 votes)
3 views18 pages

Computer Graphics-drawing Algorithms

The document discusses various line drawing algorithms used in computer graphics, including the Digital Differential Analyzer (DDA) and Bresenham's Line Drawing Algorithm, which are essential for representing line segments on pixel-based media. It outlines the properties and characteristics of effective algorithms, such as correctness, uniqueness, and finiteness, as well as the advantages and disadvantages of each method. Additionally, it covers circle drawing algorithms, emphasizing their reliance on symmetry and the challenges of accuracy in complex graphics.

Uploaded by

Jessa Siaton
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)
3 views18 pages

Computer Graphics-drawing Algorithms

The document discusses various line drawing algorithms used in computer graphics, including the Digital Differential Analyzer (DDA) and Bresenham's Line Drawing Algorithm, which are essential for representing line segments on pixel-based media. It outlines the properties and characteristics of effective algorithms, such as correctness, uniqueness, and finiteness, as well as the advantages and disadvantages of each method. Additionally, it covers circle drawing algorithms, emphasizing their reliance on symmetry and the challenges of accuracy in complex graphics.

Uploaded by

Jessa Siaton
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/ 18

C O M P U T E R G RA P H I C S

LINE DRAWING ALGORITHMS


L I N E D RAW I N G A L G O R I T H M

 The Line Drawing Algorithm is a graphical algorithm for representing line


segments on discrete graphical media, such as printers and pixel-based
media.”

 A line drawing algorithm is a method for estimating a line segment on


discrete graphical media such as pixel-based screens and printers
in computer graphics. Line sketching on such media necessitates an
approximation (in nontrivial cases). Lines are rasterizes in one colour
using basic methods. Spatial anti-aliasing is a sophisticated approach
that allows for a better representation of numerous colour gradations.

 To draw a line on a continuous medium, however, no algorithm is


required. Cathode-ray oscilloscopes, for example, use analogue
phenomena to create lines and curves.
L I N E D RAW I N G A L G O R I T H M

 The formula for a slope line


interception is:

 Y = mx + b

 In this formula, m is the slope line


and b is the line’s intercept of y.
Two endpoints for the line
segment are supplied in
coordinates (x1, y1) and (x2, y2).
P R O P E RT I E S O F A L I N E D RAW I N G A L G O RT I H M

 These Algorithm

•Input: At least one or more inputs must be accepted as a good


algorithm.
•Output: At least one output must produce an algorithm.

•An algorithm should be precise: The algorithm’s each step must


well-define.
•Finiteness: Finiteness is required in an algorithm. It signifies that the
algorithm will come to a halt once all of the steps have been complete.
P R O P E RT I E S O F A L I N E D RAW I N G A L G O RT I H M

 These Algorithm has the following characteristics:

•Correctness: An algorithm must be implemented correctly.

•Uniqueness: The result of an algorithm should be based on the given


input, and all steps of the algorithm should be clearly and uniquely
defined.
•Effectiveness: An algorithm’s steps must be correct and efficient.

•Easy to understand: Learners must be able to understand the solution


in a more natural way thanks to an algorithm.
T Y P E S O F L I N E D RAW I N G A L G O R I T H M

 For drawing a line, the following algorithms are use:

•DDA (Digital Differential Analyzer) Line Drawing Algorithm

•Bresenham’s Line Drawing Algorithm


D D A ( D I G I TA L D I F F E R E N T I A L A N A LY Z E R )

 A DDA Algorithm, also known as a Digital Differential Algorithm, is an


incremental conversion method. Moreover, The usage of the results from
the preceding stage in each calculation distinguishes this method.
D D A ( D I G I TA L D I F F E R E N T I A L A N A LY Z E R )

 Advantages of Digital Differential Analyzer

•Firstly, It’s a straightforward algorithm to implement.

•The direct line equation is a slower algorithm.

•In the Digital Differential Analyzer, we are unable to apply the


multiplication approach.
•When a point changes its location, the Digital Differential Analyzer
method alerts us about the overflow.
D D A ( D I G I TA L D I F F E R E N T I A L A N A LY Z E R )

 DDA Algorithm Limitations

•Firstly, It takes a long time to do floating point arithmetic and rounding


points.
•A round-off mistake may cause the measured pixel location to deviate
from the true long-line segment path.
BRESENHAM LINE ALGORITHM

 In 1962, “Jack Elton Bresenham” proposed this algorithm. This algorithm


aids in the conversion of a line’s scan. It’s a strong, useful, and precise
method. Furthermore, To draw a line, we employ incremental integer
calculations. Addition, subtraction, and multiplication are among the
integer calculations.

 In addition, We must determine the slope (m) between the starting point
and the final point in Bresenham’s Line Drawing procedure.
BRESENHAM LINE ALGORITHM

 Disadvantages of Bresenham’s Line Drawing Algorithm

•Bresenham’s Line Drawing Algorithm only aids in the creation of


fundamental lines.
•The drawn line is not smooth as a result.
BRESENHAM LINE ALGORITHM

 Advantages of Bresenham’s Line Drawing Algorithm

•An incremental algorithm that is quick.

•Only integer computations are use in this


M I D - P O I N T C I RC L E D RAW I N G A L G O R I T H M

 The mid-point circle drawing algorithm is an algorithm used to determine


the points needed for rasterizing a circle. We use the mid-point algorithm
to calculate all the perimeter points of the circle in the first octant and
then print them along with their mirror points in the other octants. This
will work because a circle is symmetric about its center.
B R E S E N H A M ’ S C I RC L E D RAW I N G A L G O R I T H M

 Bresenham Circle Drawing Algorithm attempts to generate the points of one


octant. The points for other octacts are generated using the eight symmetry
property.
C I RC L E D RAW I N G A L G O R I T H M

1. Mid-Point circle drawing algorithm

2. Bresenham’s circle drawing algorithm

 Both of these algorithms uses the key feature of circle that it is highly
symmetric. So, for whole 360 degree of circle we will divide it in 8-parts
each octant of 45 degree. In order to do that we will use Bresenham’s
Circle Algorithm for calculation of the locations of the pixels in the first
octant of 45 degrees. It assumes that the circle is centered on the origin.
So for every pixel (x, y) it calculates, we draw a pixel in each of the 8
octants of the circle as shown below :
C I RC L E D RAW I N G A L G O R I T H M
C I RC L E D RAW I N G A L G O R I T H M

Advantages
•It is a simple algorithm.

•It can be implemented easily

•It is totally based on the equation of circle i.e. x 2 +y2 =r2

Disadvantages
•There is a problem of accuracy while generating points.

•This algorithm is not suitable for complex and high graphic images.
T H A N K YO U

Brita Tamm

502-555-0152

[email protected]

www.firstupconsultants.com

You might also like