Draw line segment - digital differential analyzer algorithm, Computer Graphics

Assignment Help:

Example 1: Draw line segment from point (2, 4) to (9, 9) by using Digital Differential Analyzer algorithm.

Solution: We know usual equation of line is specified via

y = mx+c; here m =( y1 - y0/( x1 - x0)

Specified (x0, y0) → (2, 4) ; (x1, y1) → (9, 9)

⇒ m = ( y1 -y0)/( x1 - x0)

= (9 - 4) /(9 - 2)= 5/7..that is 0< m<1

C = y1- mx1 = 9 - ((5/7)* 9) = (63 - 45)/7 = 18/7

Conversely, by Equation of line (y = mx + c) we have

Y = (5/7)x + (18/7)

DDA Algorithm Two case:

Case 1: m < 1             xi + 1 = xi + 1 yi + 1 = yi + m

Case 2: m > 1             xi + 1 = xi + (1/m)

yi + 1 = yi + 1

Since 0 < m < 1  so as per to DDA algorithm case 1

xi + 1 = xi + 1                   yi + 1 = yi + m

Specified (x0, y0) = (2, 4)

1)      x1 = x0 + 1 = 3

Y1 = y0 + m= 4 +5/7= 4 (5/7)

Place pixel (x0, round y, colour)

That is put on (3, 5)

2) x2 = x1 + 1 = 3 + 1 = 4

y2 = y1 + m = (33/7) +(5/7)

Place on (4, 5)

Likewise go on till (9, 9) is reached.


Related Discussions:- Draw line segment - digital differential analyzer algorithm

Computer arthcther, How many 128 x 8 RAM chips are needed to provide a memo...

How many 128 x 8 RAM chips are needed to provide a memory capacity of 4096 16 bits?

Image space -approaches for visible surface determination, Image Space Appr...

Image Space Approach -Approaches for visible surface determination The initial approach as image-space, determines that of n objects in the scene is visible at every pixel in

What is jpeg, Question 1 What is JPEG? How do you change the quality of a ...

Question 1 What is JPEG? How do you change the quality of a JPEG image? Question 2 What are the advantages and challenges of virtual classroom? Question 3 What do

Characteristics of vector drawings, Characteristics of vector drawings: Ve...

Characteristics of vector drawings: Vector drawings are generally pretty small files as they include only data about the Bezier curves which form the drawing. The EPS-file format

Positioning Techniques, Explain Positioning Techniques in computer Graphics...

Explain Positioning Techniques in computer Graphics in detail

Limitations of cohen sutherland line clipping algorithm, Limitations of Coh...

Limitations of Cohen Sutherland line clipping Algorithm The algorithm is merely applicable to rectangular windows and not to the other convex shaped window. Consequently, a

What is an axonometric orthographic projection, What is an axonometric orth...

What is an axonometric orthographic projection and cabinet projection? The orthographic projection can show more than one face of an object.  Such an orthographic projection i

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd