Adding some more judges, here and there.
[and.git] / lib / Documentation / docs-sonyckson / 3puntos1circulo.cpp
blobc7f3a295e20b42cf12145a759c8a1312b756ae17
1 point center(double x1, double y1, double x2, double y2, double x3, double y3){
2 point p;
3 double A1 = x1-x2;
4 double A2 = x2-x3;
5 double B1 = y1-y2;
6 double B2 = y2-y3;
7 double C1 = (A1*(x1+x2) + B1*(y1+y2))/2;
8 double C2 = (A2*(x2+x3) + B2*(y2+y3))/2;
9 double d = A1*B2-A2*B1;
10 if(fabs(d)<1e-7)return p;
11 double y = (A1*C2-A2*C1)/d;
12 double x = -(B1*C2-B2*C1)/d;
13 p.x = x, p.y = y;
14 return p;