Bresenham line drawing algorithm

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

Tutor description

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

Word Count: 118
Showing Page: 1/2
#include #include #include #include int main(void){ int gd = DETECT, gm; int i, x, xe, y, ye, dx, dy, p; initgraph(&gd, &gm, "C:\\turboc3\\bgi"); printf("Enter x0:\n"); scanf("%d",&x); printf("enter y0:\n"); scanf("%d",&y); printf("Enter xe:\n"); scanf("%d",&xe); printf("enter ye:\n"); scanf("%d",&ye); dx = abs(xe-x); dy = abs(ye-y); p = (2*dy)-dx; putpixel(x, y, WHITE); for(i=0;ix){x = x+1;}else{x = x-1;}if(p<0){putpixel(x, y, WHITE);p = p+(2*dy);}

Review from student

Studypool Student
" all I can say is wow very fast work, great work thanks "

1822 tutors are online

Other Documents

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