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

Image capture formats, Image Capture Formats: Video cameras appear in...

Image Capture Formats: Video cameras appear in two various image capture formats: progressive and interlaced scan. Interlaced Scan It is a technique of enhancing the

Arguments made in favor of digital sound, Arguments made in favor of Digita...

Arguments made in favor of Digital Sound Dynamic range. Lower noise floor. Immunity to wow and flutter. Absence of generation loss. Capability to apply redu

Features for good 3-dimentional modeling , Features for good 3-Dimentional ...

Features for good 3-Dimentional modeling software are as: Multiple windows which permit you to view your model in each dimension. Capability to drag and drop primitive

Line drawing - points and lines, Line Drawing - Points and lines Line ...

Line Drawing - Points and lines Line drawing is accomplished through computing the intermediate point coordinates along the line path between two given end points. Since, scre

What is vanishing point and view reference point, What is vanishing point a...

What is vanishing point and view reference point? The perspective projections of any set of parallel lines that are not parallel to the projection plane converge to appoint cal

What is computer graphics, What is Computer Graphics. Computer graphic...

What is Computer Graphics. Computer graphics remains most existing and rapidly growing computer fields. Computer graphics may be explained as a pictorial representation or gra

Acquire a transformation matrix for perspective projection, Acquire a trans...

Acquire a transformation matrix for perspective projection for a specified object projected onto x=3 plane as viewed by (5,0,0). Solution: Plane of projection: x = 3 as given.

Graphic primitives, Graphic Primitives In previous section, we have di...

Graphic Primitives In previous section, we have discussed refreshing display devices and its categories which are Raster and Random Scan display devices. We have also discusse

Parallel source and distributed light source, Parallel source and Distribut...

Parallel source and Distributed light source a) Parallel source: this is to be noted that while point source is at an infinite distance then light rays are parallel and func

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