Dda program to plot line segments, Computer Graphics

Assignment Help:

Use DDA algorithm to get the output of your program as shown in Figure

2008_DDA program to plot line segments.png

ANs: Use DDA( ) function to plot line segments that have end points on diametrically opposite points on the circumference of a circle.  Take these points on uniform distance.  For example, you may use the following function CirclePoints() to get line segment endpoints (x1 [i], y1[i])  and (x2[i], y2[i]), i=0,1,....5 and use the array 2 y ,2 x ,1y ,1x  as input to your dda() function. Call the DDA function six times as given in plot Lines code below. 

// Compute points on the circumference of a circle.

int Points(int r, int xc, int yc, int x1[6], int y1[6],int

x2[6], int y2[6])

{

 float pi = 3.1416;

 int i=0;

 for(float theta = 0; theta

 {

  x1[i] = xc + r*cos(theta);

  y1[i] =yc+r*sin(theta);

  x2[i] = xc + r*cos(pi+theta);

  y2[i] =yc+r*sin(pi+theta);

  i++;

 }

return x1[6], y1[6], x2[6],y2[6];

}

//Plot line segments using DDA algorithm

void plotLines()

{

 int xx1[6],yy1[6],xx2[6],yy2[6];

 Points(100, 200, 200, xx1, yy1, xx2,yy2);

 for(int i=0;i<=5;i++)

  dda(xx1[i], yy1[i], xx2[i], yy2[i]);

}  

Add the above code in your program for line segment generation using dda() function and call the function plotLines in your RenderScene() function.


Related Discussions:- Dda program to plot line segments

Offset lithography printing, QUESTION A trainee designer, Susan, joins ...

QUESTION A trainee designer, Susan, joins your place of work. During a workshop, you are asked to present on printing procedures and agencies in Mauritius. Susan asks you what

Draw line segment - digital differential analyzer algorithm, 1. By using D...

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

Mpeg-1, MPEG-1 : MPEG-1 that is Moving Picture Experts Group format 1 is a...

MPEG-1 : MPEG-1 that is Moving Picture Experts Group format 1 is an industry standard encoding format that is broadly used. Its normal format is a frame size of about 352 x 240 an

#title., WHAT IS PAINTERS ALGORITHM?

WHAT IS PAINTERS ALGORITHM?

Basic approaches for visible surface determination, Basic Approaches for Vi...

Basic Approaches for Visible Surface Determination There are two basic approaches for visible-surface determination, as per if they deal along with their projected images or a

Voltage or electro-magnetic field tablet and pointer, (a)  Voltage or Elect...

(a)  Voltage or Electro-Magnetic Field Tablet and Pointer: This has a grid of wires, embedded in the tablet surface along with various voltages or magnetic fields consequent to va

Sutherland cohen line clipping algorithm, Describe briefly Sutherland Cohen...

Describe briefly Sutherland Cohen line clipping algorithm.   OR   Describe Cohen Sutherland line clipping algorithm. Cohen Sutherland line clipping algorithm In this algorith

Identify what the use of homogenous co-ordinates, 1. Why are homogeneous co...

1. Why are homogeneous co-ordinates utilized in computer vision? I want to identify what the use of homogenous co-ordinates makes possible in terms of camera models. 2. Consider

Soft image and strata studio - computer animation, Soft Image and Strata ...

Soft Image and Strata Studio - Computer Animation SoftImage It is the one of most well known computer animation software packages. It is used in several top production

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