1 #include<stdio.h> 2 #include<math.h> 3 #include<complex> 4 using namespace std; 5 struct Point { 6 double x, y; 7 Point(double x = 0, double y = 0) : x(x) , y(y) {} 8 }; 9 typedef Point Vector; 10 Vector operator + (Vector A, Vector B) { return Vector(A.x + B.x, A.y + B.y);} 11 Vector operator - (Point A, Point B) { return Vector(A.x - B.x, A.y - B.y);} 12 Vector operator * (Vector A, double P) { return Vector(A.x * P, A.y * P);} 13 Vector operator / (Vector A, double P) { return Vector(A.x / P, A.y / P);} 14 bool operator < (const Point &a, const Point &b) { 15 return a.x < b.x || (a.x == b.x && a.y < b.y); 16 } 17 const double eps = 1e-10; 18 double fabs(double x) { 19 return x > 0 ? x : -x; 20 } 21 int dcmp(double x) { 22 if(fabs(x) < eps) return 0; 23 else return x < 0 ? -1 : 1; 24 } 25 bool operator == (const Point &a, const Point &b) { 26 return dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) == 0; 27 } 28 double Dot(Vector A ,Vector B) { return A.x * B.x + A.y * B.y;}//点积 29 double Length(Vector A) { return sqrt(Dot(A, A));} //计算向量长度 30 double Angle(Vector A, Vector B) { return acos(Dot(A, B) / Length(A) / Length(B));}// 计算向量夹角 31 double Cross(Vector A, Vector B) { return A.x * B.y - A.y * B.x; } 32 double Area2(Point A, Point B, Point C) { return Cross(B - A, C - A);} 33 Vector Rotate(Vector A, double rad) { 34 return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) + A.y * cos(rad)); 35 } 36 Vector Normal(Vector A) { 37 double L = Length(A); 38 return Vector(-A.y / L, A.x / L); 39 } 40 Point GetlineIntersection(Point P, Vector v, Point Q, Vector w) { 41 Vector u = P - Q; 42 double t = Cross(w, u) / Cross(v, w); 43 return P + v * t; 44 } 45 double DistanceToLine(Point P, Point A, Point B) { 46 Vector v1 = B - A, v2 = P - A; 47 return fabs(Cross(v1, v2) / Length(v1)); 48 } 49 double DistanceToSegment(Point P, Point A, Point B) { 50 if(A == B) return Length(P - A); 51 Vector v1 = B - A, v2 = P - A, v3 = P - B; 52 if(dcmp(Dot(v1, v2) < 0)) return Length(v2); 53 else if(dcmp(Dot(v1, v2) < 0)) return Length(v3); 54 else return fabs(Cross(v1,v2)) / Length(v1); 55 } 56 Point GetLineProjection(Point P, Point A, Point B) { 57 Vector v = B - A; 58 return A + v * (Dot(v, P - A)) / Dot(v, v); 59 } 60 bool SegmentProperIntersection(Point a1, Point a2, Point b1, Point b2) { 61 double c1 = Cross(a2 - a1, b1 - a1), c2 = Cross(a2 - a1, b2 - a1), 62 c3 = Cross(b2 - b1, a1 - b1), c4 = Cross(b2 - b1, a2 - b1); 63 return dcmp(c1) * dcmp(c2) < 0 && dcmp(c3) * dcmp(c4) < 0; 64 } 65 bool Onsegment(Point p, Point a1, Point a2) { 66 return dcmp(Cross(a1 - p, a2 - p) == 0 && dcmp(Dot(a1 - p, a2 - p))) < 0; 67 } 68 double ConvexPolygonArea(Point * p, int n) { 69 double area = 0; 70 for(int i = 1; i < n - 1; ++i) 71 area += Cross(p[i] - p[0], p[i + 1] - p[0]); 72 return fabs(area / 2); 73 } 74 Point GetPoint(Point A, Point B, Point C) { 75 Vector v1 = C - B; 76 double a1 = Angle(v1, A - B); 77 v1 = Rotate(v1, a1 / 3); 78 79 Vector v2 = B - C; 80 double a2 = Angle(v2, A - C); 81 v2 = Rotate(v2, -a2 / 3); 82 83 return GetlineIntersection(B, v1, C, v2); 84 } 85 int main() { 86 int t; 87 Point A, B, C, D, E, F; 88 scanf("%d", &t); 89 while(t--) { 90 scanf("%lf%lf%lf%lf%lf%lf", &A.x, &A.y, &B.x, &B.y, &C.x, &C.y); 91 D = GetPoint(A, B, C); 92 E = GetPoint(B, C, A); 93 F = GetPoint(C, A, B); 94 printf("%.6f %.6f %.6f %.6f %.6f %.6f\n", D.x, D.y, E.x, E.y, F.x, F.y); 95 } 96 return 0; 97 }