#include <math.h>
class Cember2{
public:
struct _cember{
float x,y,r;
}cember1,cember2;
struct _nokta{
float x,y;
}nokta1,nokta2;
float dHesapla(float x1,float y1,float x2,float y2){
return sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
}
float nokta1XHesapla(float x1,float y1,float r1,float x2,float y2,float r2){
float d,x;
d=dHesapla(x1,y1,x2,y2);
x=(x2+x1)/2;
x+=((x2-x1)*(pow(r1,2)-pow(r2,2)))/(2*pow(d,2));
x+=((y2-y1)/(2*pow(d,2)))*sqrt((pow(r1+r2,2)-pow(d,2))*(pow(d,2)-pow(r2-r1,2)));
return x;
}
float nokta2XHesapla(float x1,float y1,float r1,float x2,float y2,float r2){
float d,x;
d=dHesapla(x1,y1,x2,y2);
x=(x2+x1)/2;
x+=((x2-x1)*(pow(r1,2)-pow(r2,2)))/(2*pow(d,2));
x-=((y2-y1)/(2*pow(d,2)))*sqrt((pow(r1+r2,2)-pow(d,2))*(pow(d,2)-pow(r2-r1,2)));
return x;
}
float nokta1YHesapla(float x1,float y1,float r1,float x2,float y2,float r2){
float d,y;
d=dHesapla(x1,y1,x2,y2);
y=(y2+y1)/2;
y+=((y2-y1)*(pow(r1,2)-pow(r2,2)))/(2*pow(d,2));
y-=((x2-x1)/(2*pow(d,2)))*sqrt((pow(r1+r2,2)-pow(d,2))*(pow(d,2)-pow(r2-r1,2)));
return y;
}
float nokta2YHesapla(float x1,float y1,float r1,float x2,float y2,float r2){
float d,y;
d=dHesapla(x1,y1,x2,y2);
y=(y2+y1)/2;
y+=((y2-y1)*(pow(r1,2)-pow(r2,2)))/(2*pow(d,2));
y+=((x2-x1)/(2*pow(d,2)))*sqrt((pow(r1+r2,2)-pow(d,2))*(pow(d,2)-pow(r2-r1,2)));
return y;
}
Cember2(float x1,float y1,float r1,float x2,float y2,float r2){
cember1.x=x1;
cember1.y=y1;
cember1.r=r1;
cember2.x=x2;
cember2.y=y2;
cember2.r=r2;
nokta1.x=nokta1XHesapla(cember1.x,cember1.y,cember1.r,cember2.x,cember2.y,cember2.r);
nokta1.y=nokta1YHesapla(cember1.x,cember1.y,cember1.r,cember2.x,cember2.y,cember2.r);
nokta2.x=nokta2XHesapla(cember1.x,cember1.y,cember1.r,cember2.x,cember2.y,cember2.r);
nokta2.y=nokta2YHesapla(cember1.x,cember1.y,cember1.r,cember2.x,cember2.y,cember2.r);
}
}
;