BRESENHAM’S CIRCLE DRAWING ALGORITHM


Posted Date:     Total Responses: 0    Posted By: vishnuvardan   Member Level: Gold   Points/Cash: 4   


#include
#include
#include
#include
#include
class Circle
{
private:
int gd,gm,x,y,r;
float d;
public:
void get();
void bres();
Circle();
~Circle();
}
Circle::Circle()
{
gd=DETECT;
initgraph(&gd,&gm,"K:\\tc\\bgi");
}
void Circle::get()
{
outtextxy(10,30,"Enter the radius of circle");
cin>>r;
}
Circle::~Circle()
{
closegraph();
}
void Circle::bres()
{
cleardevice();
outtextxy(100,10,"Bresenham's circle drawing algorithm");
get();
x=0;y=r;d=3-(2*r);
do
{
putpixel(200+x,200+y,15);
putpixel(200+y,200+x,15);
putpixel(200+y,200-x,15);
putpixel(200+x,200-y,15);
putpixel(200-x,200-y,15);
putpixel(200-y,200-x,15);
putpixel(200-y,200+x,15);
putpixel(200-x,200+y,15);
if(d<=0)
d=d+(4*x)+6;
else
{
d=d+(4*(x-y))+10;
y=y-1;
}
x++;
delay(10);

} while(x }
void main()
{
clrscr();
Circle c;
c.bres();
getch();
}

Attachments

  • bresenham circle drawing algorithm (2190-17254-BRESENHAM circle.doc)

  • Project Feedbacks


    No feedbacks found. Be the first to respond...

    Post Feedback
    You must Sign In to post a feedback.
    Next Project: Text And Speech Project
    Previous Project: RUN TIME STORAGE MANAGEMENT

    Return to Project Index

    Post New Project


    Related Projects


    Complete the action items below to enter to win an iPad Mini from India Study Channel! in India Study Channel - Locker on LockerDome
    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

     
    ISC Technologies, Kochi - India. © All Rights Reserved.