skip to main |
skip to sidebar
#include
#include
#include
#include
#define pi 3.14285
#define round(a)((int)(a+0.5))
int i;
void parcircle(int ,int ,float,int ) ;
void parcir(int xc,int yc,float r,int sang,int eang,int col)
{ int k;
float x,y;
for(k=sang;k { x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
}
}
void drawcir(int x,int y,float r,int sang)
{ int k=0;
int eang;
eang=sang+120;
while(k!=3)
{
parcir(x,y,r,sang,eang,(k+1));
sang=eang;
eang+=120;
k++;
}
}
void parc(int xc,int yc,float r1,int i)
{ int k=0,r; float x,y;
r=r1+20;
for(k=0;k<360;k++)
{ x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
cleardevice();
parcircle(xc,yc,r1,11);
i+=5;
drawcir(round(x),round(y),20,i);
}
}
void parcircle(int xc,int yc,float r,int col)
{ int k=0; float x,y;
for(k=0;k<360;k++)
{ x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
}
}
//========================
void main()
{ int gd,gm;
detectgraph(&gd,&gm);
int x,y,xc,yc; float r,r1;
i=0;
initgraph(&gd,&gm,"..\\bgi");
printf("\n enter the centre");
scanf("%d",&x);
scanf("%d",&y);
printf("\n enter the radius");
scanf("%f",&r);
xc=x;yc=y;
while(!kbhit())
{
parc(xc,yc,r,i);
}
}
#include
#include
#include
#include
#include
# define round(a)((int)(a+0.5))
# define pi 3.142857
int psang;
void parcir(int xc,int yc,float r,int col)
{ int k=0; float x,y;
for(k=0;k<360;k++)
{ x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
// delay(10);
}
}
//++++++++++++++++++++++++++++++++++++++++++
void ddaline(int x1,int y1,int x2,int y2,int col)
{ int steps,dx,dy,i;float xinc,yinc,x,y;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=(float)dx/steps;
yinc=(float)dy/steps;
x=x1;y=y1;
putpixel(x,y,col);
for(i=0;i {
x=x+xinc;
y=y+yinc;
putpixel(round(x),round(y),col);
}
}
//++++++++++++++++++
void drawclock()
{
setcolor(WHITE);
circle(200,200,70);
setcolor(CYAN);
circle(200,200,72);
setcolor(13);
outtextxy(190,135,"12");
outtextxy(195,260,"6");
outtextxy(135,200,"9");
outtextxy(260,200,"3");
setcolor(YELLOW);
ddaline(150,270,150,370,CYAN);
ddaline(150,370,250,370,CYAN);
ddaline(250,370,250,270,CYAN);
}
//++++++++++++++++
void main()
{int gd,gm;
detectgraph(&gd,&gm);
float xh,yh,xs,ys,mx,my,x,y;float hang=-90,mang=-90,sang=-90;
struct time t;
gettime(&t);
hang+=t.ti_hour*30;
mang+=t.ti_min*6;
sang+=t.ti_sec*0.1;
psang=60;
printf("%d: %d: %d",t.ti_hour,t.ti_min,t.ti_sec);
initgraph(&gd,&gm,"..\\bgi");
while(!kbhit())
{ cleardevice();
drawclock(); // gettime(&t); printf("%d: %d: %d",t.ti_hour,t.ti_min,t.ti_sec);
xh=200+20*cos(pi*hang/180);
yh=200+20*sin(pi*hang/180);
ddaline(200,200,round(xh),(yh),YELLOW);
mx=200+40*cos(pi*mang/180);
my=200+40*sin(pi*mang/180);
ddaline(200,200,round(mx),round(my),RED);
xs=200+60*cos(pi*sang/180);
ys=200+60*sin(pi*sang/180);
ddaline(200,200,round(xs),round(ys),BLUE);
hang+=(1/120);
mang+=0.1;
sang+=6;
if(psang==60)
{ while(psang!=120)
{
x=200+70*cos(psang*pi/180);
y=270+70*sin(psang*pi/180);
psang+=1;
ddaline(200,270,round(x),round(y),RED);
parcir(round(x),round(y),10,RED);
ddaline(200,270,round(x),round(y),BLACK);
parcir(round(x),round(y),10,BLACK);
delay(5);
}
}
if(psang==120)
{ while(psang!=60)
{
x=200+70*cos(psang*pi/180);
y=270+70*sin(psang*pi/180);
psang-=1;
ddaline(200,270,round(x),round(y),RED);
parcir(round(x),round(y),10,RED);
ddaline(200,270,round(x),round(y),BLACK);
parcir(round(x),round(y),10,BLACK);
delay(5);
}
}
delay(700);
}
getch();
}
#include
#include
#include
#include
#include
#define round(a)((int)(a+0.5))
# define pi 3.1428
float a[3][3];b[3],c[3];int n,x[20],y[20];
void ddaline(int x1,int y1,int x2,int y2,int col)
{ int dx,dy,steps,k;
float x,y,xinc,yinc;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=(float) dx/steps;
yinc=(float) dy/steps;
x=x1;y=y1;
for(k=0;k { putpixel(round(x),round(y),col);
x+=xinc;
y+=yinc;
}
}
void parcir(int xc,int yc,float r,int col)
{ int k=0; float x,y;
for(k=0;k<360;k++)
{ x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
delay(10);
}
}
void daxis()
{ ddaline(0,240,640,240,WHITE);
ddaline(320,0,320,480,WHITE);
}
//==================
void mulmat()
{ int k,j;
for (j=0;j<3;j++)
{ c[j]=0;
for(k=0;k<3;k++)
{ c[j]+=a[j][k]*b[k];
}
}
}
// **************************
void main()
{ int gd,gm;
detectgraph(&gd,&gm);
int cho,ch=1,choice,i,j; int tx,ty,ang;float sx,sy,shx,shy;
initgraph(&gd,&gm,"..\\bgi");
printf("\n enter the no of sides of polygon\n");
scanf("%d",&n);
printf("\n enter the end points of polygon\n");
for(i=0;i {
scanf("%d",&x[i]);
x[i]+=320;
scanf("%d",&y[i]);
y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0]; cleardevice();
printf("\n coordinate axes");
daxis();
for(i=0;i {
ddaline(x[i],y[i],x[i+1],y[i+1],YELLOW);
}
do{
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{ a[i][j]=0;
}
}
printf("\n menu");
printf("\n 1>translation\n2>scaling\n3>rotation \n 4>shearing \n 5>reflection");
scanf("%d",&cho);
switch(cho)
{case 1: printf("\n enter x disp n y disp");
scanf("%d ",&tx);
scanf("%d",&ty);
a[0][0]=1;a[0][2]=tx;
a[1][1]=1;
a[1][2]=ty;
a[2][2]=1;
for(i=0;i { x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];
b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;
y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
for(i=0;i { ddaline(x[i],y[i],x[i+1],y[i+1],RED);
}
// trans(tx,ty);
break;
case 2: printf("\n enter scaling factors in x and y directions");
scanf("%f",&sx);
scanf("%f",&sy);
a[0][0]=sx;
a[1][1]=sy;
a[2][2]=1;
for(i=0;i {
x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
cleardevice();
daxis();
for(i=0;i { ddaline(round(x[i]),round(y[i]),
round(x[i+1]),round(y[i+1]),RED);
}
break;
case 3:
printf("\n enter the angle of rotation(give -ve for anti clckwise)");
scanf("%d",&ang);
ang=(ang*pi/180);
a[0][0]=cos(ang);
a[0][1]=-sin(ang);
a[1][0]=sin(ang);
a[1][1]=cos(ang);
for(i=0;i {x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
cleardevice();
daxis();
for(i=0;i { ddaline(round(x[i]),round(y[i]),
round(x[i+1]),round(y[i+1]),RED);
}
break;
case 4: printf("\n 1>in x dir \n 2> in y dir");
scanf("%d",&choice);
if(choice==1)
{ printf("\n enter shx");
scanf("%f",&shx);
a[0][0]=1;a[0][1]=shx;
a[1][1]=1;
a[2][2]=2;
for(i=0;i { x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];
b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
}
else
{ printf("\n enter shy");
scanf("%f",­);
a[0][0]=1;
a[1][0]=shy;a[1][1]=1;
a[2][2]=1;
for(i=0;i { x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];
b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0]; y[i]=y[0];
}
daxis();
for(i=0;i { ddaline(x[i],y[i],x[i+1],y[i+1],RED);
}
break;
case 5:
printf("\n 1>ref abt x axis \n 2>ref abt y axis");
scanf("%d",&choice);
if(choice==1)
{ a[0][0]=1;
a[1][1]=-1;
a[2][2]=1;
for(i=0;i { x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];
b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
}
else
{
a[0][0]=-1;a[1][1]=1;a[2][2]=1;
for(i=0;i {x[i]=x[i]-320;y[i]=240-y[i];
b[0]=x[i];b[1]=y[i];
b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
x[i]=x[i]+320;y[i]=240-y[i];
}
x[i]=x[0];y[i]=y[0];
}
cleardevice();
daxis();
for(i=0;i { ddaline(x[i],y[i],x[i+1],y[i+1],RED);
}
break;
default:printf("\n wrong choice");
}
printf("\n press 1 to continue 2 to exit");
scanf("%d",&ch);
}while(ch==1);
getch();
}
#include
#include
#include
#include
#define round(a)((int)(a+0.5))
struct point{ int xc;int yc;}curpix, stk [9999];
int top=-1;
void push(int x,int y)
{ top++;
stk[top].xc=x;
stk[top].yc=y;
}
void pop()
{ curpix.xc=stk[top].xc;
curpix.yc=stk[top].yc;
top--;
}
void ddaline(int x1,int y1,int x2,int y2,int col)
{
int dx,dy,steps,k;
float x,y,xinc,yinc;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=(float)dx/steps;
yinc=(float)dy/steps;
x=x1;y=y1;
putpixel(round(x),round(y),col);
for(k=0;k { x+=xinc;
y+=yinc;
putpixel(round(x),round(y),col);
}
}
void bfill(int x,int y,int bclr,int fclr)
{ int curclr;
curclr=getpixel(x,y);
if(curclr!=fclr && curclr!=bclr)
{
putpixel(x,y,fclr);
bfill(x+1,y,bclr,fclr);
bfill(x,y+1,bclr,fclr);
bfill(x-1,y,bclr,fclr);
bfill(x,y-1,bclr,fclr);
}
}
void ffill(int x,int y,int oclr,int fclr)
{ int curclr;
curclr=getpixel(x,y);
if(curclr==oclr)
{
putpixel(x,y,fclr);
ffill(x+1,y,oclr,fclr);
ffill(x,y+1,oclr,fclr);
ffill(x-1,y,oclr,fclr);
ffill(x,y-1,oclr,fclr);
}
}
void rff(int x,int y,int oclr,int fclr)
{ int curclr;
while(top!=-1)
{ curclr=getpixel(x,y);
if(curclr==oclr)
{
putpixel(x,y,fclr);
push(x+1,y);
push(x,y+1);
push(x-1,y);
push(x,y-1);
}
pop();
x=curpix.xc;
y=curpix.yc;
}
}
void rbf(int x,int y,int bclr,int fclr)
{ int curclr;
while(top!=-1)
{ curclr=getpixel(x,y);
if(curclr!=bclr && curclr!=fclr)
{
putpixel(x,y,fclr);
push(x+1,y);
push(x,y+1);
push(x-1,y);
push(x,y-1);
}
pop();
x=curpix.xc;
y=curpix.yc;
}
}
//*********************************************
void main()
{ int gd,gm;
detectgraph(&gd,&gm);
int x[10],y[10],n,i,sumx=0,sumy=0,seedx,seedy,old;
initgraph(&gd,&gm,"..\\bgi");
printf("\n enter the no of sides of polygon\n");
scanf("%d",&n);
printf("\n enter the end points of polygon\n");
for(i=0;i {
scanf("%d",&x[i]);
scanf("%d",&y[i]);
sumx+=x[i];sumy+=y[i];
}
x[i]=x[0];y[i]=y[0];
for(i=0;i {
ddaline(x[i],y[i],x[i+1],y[i+1],2);
}
seedx=sumx/n;
seedy=sumy/n;
old=getpixel(seedx,seedy);
push(seedx,seedy);
rbf(seedx,seedy,2,RED);
getch();
}
#include
#include
#include
#include
#define pi 3.14285
#define round(a)((int)(a+0.5))
int i,j;
void parcir(int xc,int yc,float r,int sang,int eang,int col)
{ int k;
float x,y;
for(k=sang;k { x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
}
}
void drawcir(int x,int y,float r,int sang)
{ int k=0;
int eang;
eang=sang+120;
while(k!=3)
{
parcir(x,y,r,sang,eang,(k+1));
sang=eang;
eang+=120;
k++;
}
}
void main()
{int gd,gm; int x1=20,x2=20,xc1=200,xc2=600;
detectgraph(&gd,&gm);
initgraph(&gd,&gm,"..\\bgi");
i=0;
while((xc2-xc1)>40)
{ delay(100);
cleardevice();
drawcir(xc1,200,20,i);
xc1+=x1;
i++;
drawcir(xc2,200,20,j);
xc2-=x2;
j--;
}
cleardevice();
drawcir(xc1,200,20,i);
drawcir(xc2,200,20,j);
delay(100);
i=0;j=0;
while(xc1!=10)
{ delay(100);
cleardevice();
drawcir(xc1,200,20,i);
xc1-=x1;
i--;
drawcir(xc2,200,20,j);
xc2+=x2;
j++;
}
getch();
}
#include
#include
#include
#include
#include
#define round(a)((int)(a+0.5))
#define pi 3.1428
int xclip=100,x[20],y[20],n,color=0;float a[3][3];b[3],c[3];
void ddaline(int x1,int y1,int x2,int y2,int col)
{ int dx,dy,steps,k;
float x,y,xinc,yinc;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=(float) dx/steps;
yinc=(float) dy/steps;
x=x1;y=y1;
for(k=0;k { putpixel(round(x),round(y),col);
x+=xinc;
y+=yinc;
}
}
//==================
void mulmat()
{ int k,j;
for (j=0;j<3;j++)
{ c[j]=0;
for(k=0;k<3;k++)
{ c[j]+=a[j][k]*b[k];
}
}
}
// **************************
void rotate()
{ float ang=-90;int i,j;
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{ a[i][j]=0;
}
}
ang=(ang*pi/180);
a[0][0]=cos(ang);
a[0][1]=-sin(ang);
a[0][2]=100*(1-cos(ang))+150*sin(ang);
a[1][0]=sin(ang);
a[1][1]=cos(ang);
a[1][2]=150*(1-cos(ang))-100*sin(ang);
for(i=0;i { b[0]=x[i];b[1]=y[i];b[2]=1;
mulmat();
x[i]=c[0];y[i]=c[1];
}
x[i]=x[0];y[i]=y[0];
cleardevice();
for(i=0,color=1;i { ddaline(round(x[i]),round(y[i]),
round(x[i+1]),round(y[i+1]),i+1);
}
}
void clip()
{
int u[20],v[20],i=0,j=0;
float m,c;
for(i=0;i
{ //printf("\n left clip");
if(x[i] else if(x[i]>=xclip && x[i+1]>=xclip)
{ u[j]=x[i];v[j++]=y[i];
}
else
{ m=(float)(y[i+1]-y[i])/(x[i+1]-x[i]);
c=(float)(y[i]-m*x[i]);
if(x[i]>xclip)
{ u[j]=x[i];
v[j++]=y[i];
}
u[j]=xclip;
v[j++]=(int)(m*xclip+c);
}//end of else
}//end of for
ddaline(xclip,0,xclip,400,WHITE);
for(i=0;i { x[i]=u[i];
y[i]=v[i];
}
x[j]=x[0];
y[j]=y[0];
cleardevice();
ddaline(xclip,0,xclip,400,WHITE);
color+=2;
for(i=0,color=1;i {
ddaline(x[i],y[i],x[i+1],y[i+1],color);
}
getch();
}
void main()
{ int gd,gm;
detectgraph(&gd,&gm);
int i=0;
initgraph(&gd,&gm,"..\\bgi");
n=8;
x[0]=50;
x[1]=100;
x[2]= 125;
x[3]=150;
x[4]=200;
x[5]=150;
x[6]=125;
x[7]=100 ;
x[8]=50;
y[0]=175;
y[1]=200;
y[2]= 250;
y[3]=200;
y[4]=175;
y[5]=150;
y[6]=100;
y[7]=150;
y[8]=175;
for(i=0,color=1;i {
ddaline(x[i],y[i],x[i+1],y[i+1],color);
}
ddaline(xclip,0,xclip,400,WHITE);
printf("\n press enter to clip");
getch();
clip();
printf("\n press enter to rotate");
getch();
rotate();
ddaline(xclip,0,xclip,400,WHITE);
printf("\n press enter to clip");
getch();
clip();
getch();
cleardevice();
printf("\n final figure");
for(i=0,color=1;i {
ddaline(x[i],y[i],x[i+1],y[i+1],color);
}
getch();
}
#include
#include
#include
#include
#include
# define pi 3.142857
# define round(a)((int)(a+0.5))
float xc,yc;
//))))))))))))))))
void ddaline(int x1,int y1,int x2,int y2,int col)
{ int dx,dy,k,steps;
float xinc,yinc,x,y;
dx=x2-x1;dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xinc=(float)dx/(float)steps;
yinc=(float)dy/(float)steps;
x=x1;y=y1;
for(k=0;k { putpixel(round(x),round(y),col);
x+=xinc;
y+=yinc;
}
}
//)))))))))))))))
void parcir(int xc,int yc,float r,int sang,int eang,int col)
{ int k;
float x,y;
for(k=sang;k { x=xc+r*cos(pi*k/180);
y=yc+r*sin(pi*k/180);
putpixel(round(x),round(y),col);
}
}
void drawcir(int x,int y,float r,int sang)
{ int k=0;
int eang;
eang=sang+120;
while(k!=3)
{
parcir(x,y,r,sang,eang,(k+1));
sang=eang;
eang+=120;
k++;
}
}
//)))))))))))))))))
//888888888888888888888888
void pcircum(int x1,int y1,int x2,int y2,int x3,int y3,int flag)
{ float r;int i=0;
if(flag==1)
{if(y1 { r=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
r=r/2;
xc=(x1+x3)/2;
yc=(y1+y3)/2;
}
else
{ r=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
r=r/2;
xc=(x2+x3)/2;
yc=(y2+y3)/2;
}
}
if(flag==2)
{if(y1 { r=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
r=r/2;
xc=(x1+x2)/2;
yc=(y1+y2)/2;
}
else
{ r=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
r=r/2;
xc=(x2+x3)/2;
yc=(y2+y3)/2;
}
}
if(flag==3)
{if(y2 { r=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
r=r/2;
xc=(x1+x2)/2;
yc=(y1+y2)/2;
}
else
{ r=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
r=r/2;
xc=(x1+x3)/2;
yc=(y1+y3)/2;
}
}
while(!kbhit())
{ drawcir(round(xc),round(yc),r,i);
i++;
delay(1);
}
}
//;;;;;;;;;;;;;;;;
float findy(int x1,int y1,int x2,int y2,int xf)
{ float y,m1,c1,midx,midy;
m1=(float)(y1-y2)/(float)(x1-x2);
m1=(float)(-1/m1);
midx=(x1+x2)/2;
midy=(y1+y2)/2;
c1=(float)(midy-m1*midx);
y=(float)(m1*xf+c1);
return y;
}
//000000000000000000000000000
void main()
{ int gd,gm;
detectgraph(&gd,&gm);
int x1,y1,x2,y2,x3,y3,i,flag=0;float r,xf,yf;
int mx1,my1,mx2,my2;
float m1,m2,c1,c2;
initgraph(&gd,&gm,"..\\bgi");
printf("\n enter the co ordinates of the triangle");
scanf("%d",&x1);
scanf("%d",&y1);
printf("\n enter the co ordinates of the triangle");
scanf("%d",&x2);
scanf("%d",&y2);
printf("\n enter the co ordinates of the triangle");
scanf("%d",&x3);
scanf("%d",&y3);
cleardevice();
ddaline(x1,y1,x2,y2,YELLOW);
ddaline(x2,y2,x3,y3,YELLOW);
ddaline(x3,y3,x1,y1,YELLOW);
if(x1==x2)
{pcircum(x1,y1,x2,y2,x3,y3,1);
exit(0);
}
if(x1==x3)
{pcircum(x1,y1,x2,y2,x3,y3,2);
exit(0);
}
if(x2==x3)
{pcircum(x1,y1,x2,y2,x3,y3,3);
exit(0);
}
m1=(float)(y1-y2)/(float)(x1-x2);
m2=(float)(y2-y3)/(float)(x2-x3);
if(m1!=0) m1=(float)(-1/m1);
else
{ xf=(x1+x2)/2;
flag=1;
yf= findy(x1,y1,x3,y3,xf);
r=sqrt((xf-x3)*(xf-x3)+(yf-y3)*(yf-y3));
}
if(m2!=0) m2=(float)(-1/m2);
else
{ xf=(x2+x3)/2;
flag=1;
yf= findy(x1,y1,x2,y2,xf);
r=sqrt((xf-x3)*(xf-x3)+(yf-y3)*(yf-y3));
}
if(!flag)
{
mx1=(x1+x2)/2;
my1=(y1+y2)/2;
c1=(float)(my1-m1*mx1);
mx2=(x2+x3)/2;
my2=(y2+y3)/2;
c2=(float)(my2-m2*mx2);
xc=(float)(c2-c1)/(float)(m1-m2);
yc=(float)(m1*xc+c1);
r=sqrt((xc-x3)*(xc-x3)+(yc-y3)*(yc-y3));
}
i=0;
while(!kbhit())
{ if(flag)
drawcir(round(xf),round(yf),r,i);
else
drawcir(round(xc),round(yc),r,i);
i++;
delay(1);
}
getch();
}