1 #include<cstdio>
2 #include<cmath>
3 #define PI acos(-1.0)
4 using namespace std;
5
6 struct Point
7 {
8 double x,y;
9 Point(double x=0,double y=0):x(x),y(y){ }
10 // Point read_point() {scanf("%lf%lf",&this.x,&this.y);}
11 };
12 typedef Point Vector;
13 Vector operator + (Vector A,Vector B){return Vector(A.x+B.x,A.y+B.y);}
14 Vector operator - (Point A,Point B) {return Vector(A.x-B.x,A.y-B.y);}
15 Vector operator * (Vector A,double p){return Vector(A.x*p,A.y*p);}
16 Vector operator / (Vector A,double p){return Vector(A.x/p,A.y/p);}
17
18 double Dot(Vector A,Vector B){return A.x*B.x+A.y*B.y;}
19 double length(Vector A){return sqrt(Dot(A,A));}
20 double Angle(Vector A,Vector B){return acos(Dot(A,B)/length(A)/length(B));}
21
22 double Cross(Vector A,Vector B){return A.x*B.y-B.x*A.y;}
23
24 Vector Rotate (Vector A,double rad)
25 {
26 //其中rad为逆时针旋转角
27 return Vector(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad));
28 }
29
30 Point GetLineIntersection(Point P,Vector v,Point Q,Vector w)
31 {
32 Vector u=P-Q;
33 if(Cross(v,w))
34 {
35 double t=Cross(w,u)/Cross(v,w);//精度高的时候,考虑自定义分数类
36 return P+v*t;
37 }
38 // else
39 // return ;
40 }
41
42 Point getD(Point A,Point B,Point C)
43 {
44 Vector v1=C-B;
45 double a1=Angle(A-B,v1);
46 v1=Rotate(v1,a1/3);
47
48 Vector v2=B-C;
49 double a2=Angle(A-C,v2);
50 v2=Rotate(v2,-a2/3);//-表示顺时针旋转;
51
52 return GetLineIntersection(B,v1,C,v2);
53
54 }
55
56 Point read_point(Point &P)
57 {
58 scanf("%lf%lf",&P.x,&P.y);
59 return P;
60 }
61 int main()
62 {
63 int T;
64 Point A,B,C,D,E,F;
65 scanf("%d",&T);
66 while(T--)
67 {
68 A=read_point(A);
69 B=read_point(B);
70 C=read_point(C);
71
72 // scanf("%lf%lf%lf%lf%lf%lf",&A.x,&A.y,&B.x,&B.y,&C.x,&C.y);
73 // printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf
",A.x,A.y,B.x,B.y,C.x,C.y);
74 D=getD(A,B,C);
75 E=getD(B,C,A);
76 F=getD(C,A,B);
77 printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lf
",D.x,D.y,E.x,E.y,F.x,F.y);
78 }
79 return 0;
80 }