2]bresenham's Line Algorithm.docx

  • Uploaded by: Yugendra Walavalkar
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 2]bresenham's Line Algorithm.docx as PDF for free.

More details

  • Words: 78
  • Pages: 2
CODE:/*Bresenham's Line Algorithm*/ #include<stdio.h> #include #include<math.h> #include

void main() { int gd=DETECT,gm,i; float steps,dx,dy,x,y,x1=200,y1=200,x2=400,y2=400,e; initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); printf("Enter 1st point:"); scanf("%d%d",&x1,&y1); printf("Enter 2nd point:"); scanf("%d%d",&x2,&y2); dx = x2-x1; dy = y2-y1; if(dx>dy) steps = abs(dx); else steps = abs(dy); x = x1; y = y1; e = 2*dy - dx; for(i=0;i<steps;i++) { putpixel(x,y,GREEN); while(e>=0)

{ y = y + 1; e = e - 2*dx; } x = x + 1; e = e + 2*dy; }

getch(); closegraph(); }

Related Documents

Line
June 2020 11
Line
April 2020 24
Line #1 Cookie Line
May 2020 15
Straight Line
May 2020 20
Punch Line
October 2019 30

More Documents from ""

Final Result.docx
December 2019 1
Biomedical.docx
December 2019 2