Practical 3 CGR PDF
Practical 3 CGR PDF
Practical 3 CGR PDF
I. Practical Significance
V. Practical Outcome(POs):
Bresenham’s line algorithm determines the points to an n-dimensional raster that is selected to
form a close approximation to a straight line between two points. It is used to draw line primitives in
a bitmap image, as it uses only integer addition, subtraction and bit shifting.it is an incremental error
algorithm. It is one of the earliest algorithm developed in the field of computer graphics.
Consider a line with initial point (x1,y1) and terminal point (x2,y2) in device space. if Δx=x2-x1 and
Δy=y2-y1,we define the driving axis (DA) to be the x-axis if |Δx|≥ |Δy| and the y-axis if if |Δy|≥
|Δx|.The DA is used as the “axis of control” for the algorithm and is the axis of maximum movement.
Within the main loop of the algorithm, the co-ordinate corresponding to the DA is incremented by
one unit. The coordinate corresponding to the other axis (usually denoted by the passive axis or PA)
is only incremented as needed.
Procedure
I. Algorithm
(Write on blank pages)
II. Flowchart
(Draw on blank pages)
III. ‘C’ Program Code
I. Resources required
XI. Precautions
XII. Results
……………………………………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………………………………
……………………………………………………………………………………………………………………………………………………….
XIII. Conclusion(s)
…………………………………………………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………………………………………………..
…………………………………………………………………………………………………………………………………………………………..
XV Exercise
1.Give following values for every iteration of bresenham’s algorithm to draw a line from (3,4) to (6,8)
Δx Δy 2Δx 2Δy P
2. 1.Give following values for every iteration of bresenham’s algorithm to draw a line from (-6,-6) to
(-14,-14)
Δx Δy 2Δx 2Δy P