DDA line drawing algorithm

Apr 14th, 2015
Studypool Tutor
Price: $5 USD

Tutor description

A graphics program for drawing a line using DDA line drawing algorithm. It draws a line at the specified coordinates(start point and end point). It also works with negative slope

Word Count: 124
Showing Page: 1/2
#include #include #include #include int main(void){ int gd = DETECT, gm; int i, xmin, xmax, ymin, ymax, steps; float dx, dy, xl, yl; initgraph(&gd, &gm, "C:\\turboc3\\bgi"); printf("Enter xmin:\n"); scanf("%d",&xmin); printf("enter ymin:\n"); scanf("%d",&ymin); printf("Enter xmax:\n"); scanf("%d",&xmax); printf("enter ymax:\n"); scanf("%d",&ymax); dx = abs(xmax-xmin); dy = abs(ymax-ymin); if(dx>dy) {steps = dx; } else {steps = dy; } dx = dx/steps; dy = dy/steps; xl = xmin;

Review from student

Studypool Student
" <3 it, thanks for saving me time. "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors