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

Traditional animation techniques - computer animation, Traditional Animatio...

Traditional Animation Techniques - Computer Animation Before the advent of computer animation, each animation was done via hand that involves an enormous amount of work. You

Important point about the de casteljeau algorithm, Important point about th...

Important point about the De casteljeau algorithm 1)      Bezier Curve: P (u) =    ................     (1) Here B n,i (u) = n c i u i (1 - u) n-i        ..

What will be the resulting rotation matrix, An object has to be rotated abo...

An object has to be rotated about an axis passing through the points (1,0 ,1), (1,3,1) .  What will be the resulting rotation matrix?    Solution: The axis is parallel to y axis

Sound editing programs, Sound Editing Programs; Sound editing tools for bo...

Sound Editing Programs; Sound editing tools for both digitized and MIDI sound; by that you see music and also hear it. Through drawing a representation of a sound in fine growths,

What do you mean by perspective projection, What do you mean by Perspective...

What do you mean by Perspective projection?  Perspective projection is one in which the lines of projection are not parallel. Instead, they all converge at a single point known

Linearly interpolate - modeling and rendering, Linearly interpolate - Model...

Linearly interpolate - Modeling and Rendering I 4 = I 1 + t (I 2 - I 1 ); here t = (|y 1 - y 2 |)/(|y 1 - y 2 |) I D = I A + t (I B - I A ); here t = (|AD|)/(|AB|)

Overstriking, why overstriking is harmful.justify

why overstriking is harmful.justify

State the technology used in lcd, State the technology used in LCD Some...

State the technology used in LCD Some passive matrix (Pixels are illuminated in scanline order like a raster display but  the lack of phospherescence causes flicker) LCDs have

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