LINE DRAWING
Basic Concepts of Line Drawing
Before discussing specific line drawing algorithms it is useful to note
the general requirements for such algorithms.
● The line
should appear as a straight line.
Vertical and Line
with other orientation
horizontal lines
Horizontal and vertical lines are straight and have same width. The line
with any other orientation is neither straight nor has same width. In this case
we have to accept approximate pixels in such situations.
Rasterization of straight lines.
Rasterization yields uneven brightness: Horizontal and
vertical lines appear brighter than the 45° lines.
For
fixing so, we would need:
1. Calculation of square roots (increasing
CPU time)
2. Multiple brigthness levels

=

Compromise:
1.
Calculate only an approximate line
2.
Use integer arithmetic
3.
Use incremental methods

Line should terminate accurately.
Unless they are
plotted correctly, they may terminate at the wrong place.
• Line
should have constant density.
To maintain
constant density dots should be equally spaced.
• The
line should be drawn rapidly.
This implies that
we have to draw line using minimum of computation.
Pixel plotting
Nine pixels are there in 3 rows and columns. Pixels are designated by
the location of their centers in the pixel grid.
Line  Drawing Algorithm
The Cartesian slope  intercept equation for a straight line is
y = m x + b
with m representing the slope of the line and b as the y intercept.
Given that the two endpoints of a line segment are specified at
positions (x_{1}, y_{1}) and (x_{2}, y_{2}). We
can determine values for the slope m and y intercept b with the following
calculations:
y_{2
 }y_{1}
m =

x_{2
 }x_{1}
For any given x interval ∆x along a line, we can compute the
corresponding y interval ∆y as
∆y = m ∆x
Similarly, we can obtain the x interval ∆x corresponding to a specified ∆y
as
∆y
∆x = 
m
No comments:
Post a Comment