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

Explain clearly the condense editing using examples, QUESTION 1. Creat...

QUESTION 1. Create a COMPLETE storyboard for a movie of 2 minutes duration on ONE of the following subject: a. Poverty b. Global Warming c. Smoking d. Drugs e. D

Need for video compression, Need for Video Compression: T he high bit ...

Need for Video Compression: T he high bit rates that result from the various types of digital video make their transmission through their intended channels very difficult. Eve

Define pixel and frame buffer, Define pixel and frame buffer? Pixel is ...

Define pixel and frame buffer? Pixel is shortened forms of picture element. Every screen point is referred to as pixel or pel.  Picture definition is kept in a memory area c

Line drawing algorithm, Adavantage and disadvantages of DDA and Bresenhams ...

Adavantage and disadvantages of DDA and Bresenhams line drawing algorithm

Scale a sphere cantered on the point (1, Scale a sphere cantered on the poi...

Scale a sphere cantered on the point (1, 2, and 3) with radius 1, so that the new sphere has the same centre with radius 2.    Solution: Translate the sphere so that its centre

Display devices - graphics hardware, Display Devices - Graphics Hardware ...

Display Devices - Graphics Hardware Since the importance of output and input devices has been discussed over, so let us now focus our discussion particularly on display dev

What are the utilizations of inverse transformation, What are the utilizati...

What are the utilizations of Inverse transformation? Provide the Inverse transformation for translation, shearing, reflection, scaling and rotation. Solution: We have observed

Variation of intensity - modeling and rendering, Variation of Intensity - M...

Variation of Intensity - Modeling and Rendering According to the phong model the variation of Intensity (I) along with α (since I α cos n α) is: i) for shiny surface (

Hypertext, Hypertext: it is conceptually very similar as regular text: it ...

Hypertext: it is conceptually very similar as regular text: it can be stored, searched, read, or edited along with a significant difference: hypertext is text along with pointers

Types of polygon tables curves and surfaces, Types of Polygon tables curves...

Types of Polygon tables curves and surfaces Attribute tables: This table has object information as transparency, surface reflexivity, texture features of an object in the vi

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