Draw line segment - digital differential analyzer algorithm, Computer Graphics

Assignment Help:

1. By using Digital Differential Analyzer algorithm draw line segments from point (1,1) to (9,7).

Ans. We see that the usual equation of the line is specified by:

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

Specified (x0, y0) → (1, 1) ; (x1, y1) → (9, 7)

⇒ m = (7-1)/(9-1) =6/8

C = y1 - mx1 = 7 - (6/8) *9 = 1/4

Consequently, by equation of line (y = mx + c) we contain: 

 y = (6/8)x+(1/4)

  Digital Differential Analyzer 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

Here m < 1 so as per to Digital Differential Analyzer algorithm case 1

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

Specified (x0, y0) = (1, 1)

1) x1 = x0 + 1 = 2

y1 = y0 + m = 1+ (6/8) = 7/4

Place pixel (x0, round y, colour)

That is, put on (2, 2)

Likewise, go on until (9, 7) is arrived at.


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

Associative links, Associative Links: it is a link that is completely inde...

Associative Links: it is a link that is completely independent of the exact structure of the information. For illustration we have links depends on the meaning of various informat

Write a c program to create a window of specified size, Write a C program t...

Write a C program to create a window of specified size and position and draw the following objects with dimensions of your choice, to fit within the window.   (a) A point  (b) A

Real time clock -rtc, Main objectives: To test to micro-controller I...

Main objectives: To test to micro-controller I2C protocol bus functionality Setting and displaying accurate time and date on the LCD GENERAL DESCRIPTION The D

Random scan display device - types of refresh monitors, Random Scan Display...

Random Scan Display Device The original cathode ray tube, developed in the late fifties and early sixties, produced charts and pictures, line through line on the tube surface

Curved surfaces, Build a program that allows: 1. using mouse or keyboard...

Build a program that allows: 1. using mouse or keyboard to move around on a set of 16 control points;  2. modify the value (drag along x, y, or z) of a point;  3. display

Cohen sutherland algorithm - 2d clipping algorithms, Cohen Sutherland algor...

Cohen Sutherland algorithm Point clipping is very simple.  All you need to check is whether a point is inside the window extremes in x- and y-directions.  For line clipping sev

Picture information - raster graphics and clipping, Picture Information - ...

Picture Information - Raster Graphics and  Clipping Now, the picture information is accumulated in the form of bit plans on which all bit plane complete information of pictur

Parallel projection - viewing transformation, Parallel Projection - viewing...

Parallel Projection - viewing transformation Parallel projection methods are utilized by engineers to make working drawings of an object that preserves its true shape. In t

What is a spline, What is a spline?  To produce a smooth curve by a des...

What is a spline?  To produce a smooth curve by a designed set of points, a flexible strip called spline is used. Like spline curve can be mathematically explained with a piece

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