The document discusses line drawing algorithms in computer graphics. It describes the Cartesian equation for a straight line and how to specify two endpoints of a line segment. It then explains the digital differential analyzer (DDA) line algorithm which calculates either the change in x or y between integer points on the line based on the slope, and determines the corresponding integer coordinate values. The DDA algorithm has steps to handle lines with positive and negative slopes, as well as processing lines from left to right or right to left.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
31 views7 pages
Lecture 3
The document discusses line drawing algorithms in computer graphics. It describes the Cartesian equation for a straight line and how to specify two endpoints of a line segment. It then explains the digital differential analyzer (DDA) line algorithm which calculates either the change in x or y between integer points on the line based on the slope, and determines the corresponding integer coordinate values. The DDA algorithm has steps to handle lines with positive and negative slopes, as well as processing lines from left to right or right to left.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 7
Computer Graphics
Lecture-3 Line Equation The Cartesian slop-intercept equation for a straight line is y=mx+b ------ (1) with m->slope, b->y intercept
The 2 end points of a line segment are specified at a position(x1,y1) and
(x2,y2). Line DDA Algorithm The digital differential analyzer(DDA) is a scan conversion line algorithm based on calculation either Dy or Dx. The line at unit intervals is one coordinate and determine corresponding integer values nearest line for the other coordinate. Consider first a line with positive slope. Step : 1 If the slope is less than or equal to 1, the unit x intervals Dx =1 and compute each successive y values. Dx =1 m= Dy / Dx m = ( y2 y1 ) / 1 m = (yk+1 yk)/ 1 yk+1 = yk + m Step : 2 If the slope is greater than 1, the roles of x any y at the unit y intervals Dy =1 and compute each successive x values. Dy =1 m= Dy / Dx m = 1 / (x2 x1 ) m = 1 / (xk+1 xk) xk+1 = xk + (1/m) Step : 3 If the processing is reversed, the starting point at the right Dx =-1 m= Dy / Dx m = ( y2 y1 ) / -1 yk+1 = yk - m Step : 4 Here, Dy =-1 m= Dy / Dx m = -1 / (x2 x1 ) m = -1 / (xk+1 xk) xk+1 = xk (1/m)