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

Describe the elements of design pattern, Question: (a) Using suitable ...

Question: (a) Using suitable examples, explain the following basic principles of design: (i) Proximity (ii) Repetition (iii) Contrast (iv) Alignment. (b) Color h

Sub classes of orthographic projection, Sub Classes of Orthographic Project...

Sub Classes of Orthographic Projection There are three ordinary sub-classes of Orthographic (axonometric) projections as: 1) Isometric: The direction of projection makes

What is a color management system, QUESTION a) What is a color manageme...

QUESTION a) What is a color management system? Briefly explain how it works. b) What are the three major factors affecting print permanence? c) Briefly explain three ways

Scan conversion - 2d shape primitives, Scan conversion: For display of...

Scan conversion: For display of a continuously defined object, a method to map a continuous abstract object or shape into a discrete plane of computer display is needed.  This

Illustration of a clipping window - raster graphics, Illustration of a Clip...

Illustration of a Clipping window ABCD is placed as follows: A (100, 10), B (160, 10, C (160, 40), D (100, 40) By using Sutherland-Cohen clipping algorithm determine the vis

Define polygon, Define polygon?  A polygon is any closed continues sequ...

Define polygon?  A polygon is any closed continues sequence of line segments i.e., a polyline whose last node point is similar as that of its first node point. The line segment

What is translation, What is translation?  Translation is the process o...

What is translation?  Translation is the process of changing the position of an object in a straight-line path from one coordinate location to another. Each point (x, y) in the

Proof of subsequent properties of bezier curves, Proof of subsequent proper...

Proof of subsequent properties of Bezier curves Note: Proof of subsequent properties of Bezier curves is left as a work out for the students P' (0) = n (p 1 - p 0 ) P

Boundary-fill algorithm or flood-fill algorithm , boundary-fill algorithm o...

boundary-fill algorithm or flood-fill algorithm As you saw the implementation of scan line polygon fill requires that boundaries should be straight line segments.  The seed fi

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