[go: up one dir, main page]

60% found this document useful (30 votes)
33K views2 pages

Example On Bresenhams Line Drawing Algorithm

The document describes applying Bresenham's line algorithm to rasterize the line from (0,0) to (-8,-4). It calculates the decision variable e, initializes x and y, and tabulates the algorithm's steps. The line is rasterized as the points (-1,0), (-2,-1), etc. ending at (-8,-4). A graph shows the rasterized line.

Uploaded by

Punam Patil
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
60% found this document useful (30 votes)
33K views2 pages

Example On Bresenhams Line Drawing Algorithm

The document describes applying Bresenham's line algorithm to rasterize the line from (0,0) to (-8,-4). It calculates the decision variable e, initializes x and y, and tabulates the algorithm's steps. The line is rasterized as the points (-1,0), (-2,-1), etc. ending at (-8,-4). A graph shows the rasterized line.

Uploaded by

Punam Patil
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/ 2

Example: Consider the line from (0, 0) to (-8,-4), use general Bresenhams line algorithm to

rasterize this line. Evaluate and tabulate all the steps involved.
Solution:
Given data,
(x1, y1)= (0, 0)
(x2, y2)= (-8,-4)
x=x2-x1=-8-0=8
S1=-1
y=y2-y1=-4-0=4
S2=-1
Decision Variable=e=2*(y)-(x)
e= 2*(4)-(8)
=8-8 =0
e=0

By using general Bresenhams algorithm,


The result in tabulated form as,

Pixel

Initially (0,0)

(-1,0)

+8

-1

(-2,-1)

-2

-1

(-3,-1)

-8

-3

-1

(-4,-2)

-4

-2

(-5,-2)

+8

-5

-2

(-6,-3)

-6

-3

(-7,-3)

+8

-7

-3

(-8,-4)

-8

-4

By pictorial presentation in graph is as shown below,

(0, 0)

-1

-2

-3

-4

-5

-6

-7

-8

-1
-2
-3
-4
-5
-6

--- This is required solution for the given line using Bresenhams algorithm.

You might also like