View
218
Download
0
Category
Preview:
Citation preview
8/17/2019 Bresenham Line Program C Under Graphics CAD/CAM
1/1
/*** Program to Draw a Line using Bresenham's Algorithm ***/
#include
#include
#include
void lineBresint! int! int! int"
void main"
$
int %&! &! %n! n
int gd ( D))+! gm
initgraph,gd! ,gm! --"
print-)nter starting coordinates o line -"
scan-0d 0d-! ,%&! ,&"
print-)nter ending coordinates o line -"
scan-0d 0d-! ,%n! ,n"
lineBres%&! &! %n! n"
getch"
1
void lineBresint %&! int &! int %n! int n"
$
int d% ( %n 2 %&! d ( n 2 &
int di ( 3 * d 2 d%
int ds ( 3 * d! dt ( 3 * d 2 d%"
putpi%el%&! &! 4)D"
www.eazynotes.com Gursharan Singh Tatla Page No. 2while %& < %n"
$
%&55
i di < 6"
di ( di 5 dselse
$
&55
di ( di 5 dt
1
putpi%el%&! &! 4)D"
dela36"
1
1
Recommended