& sol) { if (dcmp(DistanceToLine(cir.c,L.p,L.p+L.v)-cir.r)==0) { sol.pb(GetLineProjection(cir.c,L.p,L.p+L.v)); return 1; } double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d= L.p.y - cir.c.y; double e = a*a+c*c, f = 2*(a*b + c*d), g = b*b+d*d-cir.r*cir.r; double delta = f*f - 4*e*g; if (dcmp(delta)<0) return 0; else if (dcmp(delta)==0) { t1 = t2 = -f / (2*e); sol.pb(L.point(t1)); return 1; } t1 = (-f - sqrt(delta)) / (2*e); sol.pb(L.point(t1)); t2 = (-f + sqrt(delta)) / (2*e); sol.pb(L.point(t2)); return 2; } double angle(V v) {return atan2(v.y,v.x);} int getCircleCircleIntersection(C C1,C C2,vector
& sol) { double d = Length(C1.c-C2.c); if (dcmp(d)==0) { if (dcmp(C1.r - C2.r)==0) return -1; //2圆重合 return 0;
} if (dcmp(C1.r+C2.r-d)<0) return 0; if (dcmp(fabs(C1.r-C2.r)-d)>0) return 0; double a = angle(C2.c-C1.c); double da = acos((C1.r*C1.r+d*d - C2.r*C2.r)/ (2*C1.r*d));
P p1 = C1.point(a-da), p2 = C1.point(a+da);
sol.pb(p1); if (p1==p2) return 1;
sol.pb(p2); return 2;
} // Tangents-切线 int getTangents(P p,C c,V* v) {
V u= c.c-p; double dist = Length(u); if (dist
& sol) { V e=Normal(l.v); Line l1=LineTranslation(l,e*r),l2=LineTranslation(l,e*(-r)); double t1,t2; getLineCircleIntersection(l1,C(p,r),t1,t2,sol); getLineCircleIntersection(l2,C(p,r),t1,t2,sol); } void CircleTangentToTwoLinesWithRadius(Line l1,Line l2,double r,vector
& sol) { V e1=Normal(l1.v),e2=Normal(l2.v); Line L1[2]={LineTranslation(l1,e1*r),LineTranslation(l1,e1*(-r))}, L2[2]={LineTranslation(l2,e2*r),LineTranslation(l2,e2*(-r))}; Rep(i,2) Rep(j,2) sol.pb(GetLineIntersection(L1[i].p,L1[i].v,L2[j].p,L2[j].v)); } void CircleTangentToTwoDisjointCirclesWithRadius(C c1,C c2,double r,vector
& sol) { c1.r+=r; c2.r+=r; getCircleCircleIntersection(c1,c2,sol); } P getP(P A,P B,P C) { P D=B+(C-B)/3; P E=C+(A-C)/3; return GetLineIntersection(A,D-A,B,E-B); } int main() { // freopen("uva11437.in","r",stdin); // freopen(".out","w",stdout); int T=read(); while(T--){ P A=read_point(),B=read_point(),C=read_point(); P p[3]={getP(A,B,C),getP(B,C,A),getP(C,A,B)}; printf("%0.lf\n",PolygonArea(p,3)); } return 0; }
& sol) { if (dcmp(DistanceToLine(cir.c,L.p,L.p+L.v)-cir.r)==0) { sol.pb(GetLineProjection(cir.c,L.p,L.p+L.v)); return 1; } double a = L.v.x, b = L.p.x - cir.c.x, c = L.v.y, d= L.p.y - cir.c.y; double e = a*a+c*c, f = 2*(a*b + c*d), g = b*b+d*d-cir.r*cir.r; double delta = f*f - 4*e*g; if (dcmp(delta)<0) return 0; else if (dcmp(delta)==0) { t1 = t2 = -f / (2*e); sol.pb(L.point(t1)); return 1; } t1 = (-f - sqrt(delta)) / (2*e); sol.pb(L.point(t1)); t2 = (-f + sqrt(delta)) / (2*e); sol.pb(L.point(t2)); return 2; } double angle(V v) {return atan2(v.y,v.x);} int getCircleCircleIntersection(C C1,C C2,vector
& sol) { double d = Length(C1.c-C2.c); if (dcmp(d)==0) { if (dcmp(C1.r - C2.r)==0) return -1; //2圆重合 return 0;
} if (dcmp(C1.r+C2.r-d)<0) return 0; if (dcmp(fabs(C1.r-C2.r)-d)>0) return 0; double a = angle(C2.c-C1.c); double da = acos((C1.r*C1.r+d*d - C2.r*C2.r)/ (2*C1.r*d));
P p1 = C1.point(a-da), p2 = C1.point(a+da);
sol.pb(p1); if (p1==p2) return 1;
sol.pb(p2); return 2;
} // Tangents-切线 int getTangents(P p,C c,V* v) {
V u= c.c-p; double dist = Length(u); if (dist
& sol) { V e=Normal(l.v); Line l1=LineTranslation(l,e*r),l2=LineTranslation(l,e*(-r)); double t1,t2; getLineCircleIntersection(l1,C(p,r),t1,t2,sol); getLineCircleIntersection(l2,C(p,r),t1,t2,sol); } void CircleTangentToTwoLinesWithRadius(Line l1,Line l2,double r,vector
& sol) { V e1=Normal(l1.v),e2=Normal(l2.v); Line L1[2]={LineTranslation(l1,e1*r),LineTranslation(l1,e1*(-r))}, L2[2]={LineTranslation(l2,e2*r),LineTranslation(l2,e2*(-r))}; Rep(i,2) Rep(j,2) sol.pb(GetLineIntersection(L1[i].p,L1[i].v,L2[j].p,L2[j].v)); } void CircleTangentToTwoDisjointCirclesWithRadius(C c1,C c2,double r,vector
& sol) {
c1.r+=r; c2.r+=r;
getCircleCircleIntersection(c1,c2,sol);
}
P p[4]; bool ConvexPolygon(P &A,P &B,P &C,P &D) { if (SegmentProperIntersection(A,C,B,D)) return 1;
swap(B,C); if (SegmentProperIntersection(A,C,B,D)) return 1;
swap(D,C); if (SegmentProperIntersection(A,C,B,D)) return 1; return 0;
} bool IsParallel(P A,P B,P C,P D) { return dcmp(Cross(B-A,D-C))==0;
} bool IsPerpendicular(V A,V B) { return dcmp(Dot(A,B))==0;
} //先调用ConvexPolygon 求凸包并确认是不是是4边形 // Trapezium-梯形 Rhombus-菱形 bool IsTrapezium(P A,P B,P C,P D){ return IsParallel(A,B,C,D)^IsParallel(B,C,A,D);
} bool IsParallelogram(P A,P B,P C,P D) { return IsParallel(A,B,C,D)&&IsParallel(B,C,A,D);
} bool IsRhombus(P A,P B,P C,P D) { return IsParallelogram(A,B,C,D)&&dcmp(Length(B-A)-Length(C-B))==0;
} bool IsRectangle(P A,P B,P C,P D) { return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A);
} bool IsSquare(P A,P B,P C,P D) { return IsParallelogram(A,B,C,D)&&IsPerpendicular(B-A,D-A)&&dcmp(Length(B-A)-Length(C-B))==0;
} int main()
{ // freopen("uva11800.in","r",stdin); // freopen(".out","w",stdout); int T=read();
For(kcase,T) {
Rep(i,4) p[i]=read_point(); cout<<"Case "<