1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <queue> #include <set> #include <vector> using namespace std;
const int INF = ~0u>>1; typedef pair <int,int> P; #define MID(x,y) ((x+y)>>1) #define iabs(x) ((x)>0?(x):-(x)) #define REP(i,a,b) for(int i=(a);i<(b);i++) #define FOR(i,a,b) for(int i=(a);i<=(b);i++) #define pb push_back #define mp make_pair #define print() cout<<"--------"<<endl #define EPS 1e-8 typedef struct Point { double x,y; Point(double x = 0, double y = 0):x(x),y(y){} void read_point(){ scanf("%lf%lf", &x, &y); } }Vector;
struct Line { Point p; Vector v; double a; Line (Point p = Point(),Vector v = Vector(1,0)):p(p),v(v){ a = atan2(v.y, v.x); } bool operator < (const Line &u) const { return a < u.a; } };
Vector operator + (Vector A, Vector B){ return Vector(A.x + B.x, A.y + B.y); } Vector operator - (Vector A, Vector B){ return Vector(A.x - B.x, A.y - B.y); } Vector operator * (Vector A, double k){ return Vector(A.x * k, A.y * k); }
inline double cross(Vector A, Vector B){ return A.x * B.y - A.y * B.x; }
double Dot(Vector A, Vector B){ return A.x * B.x + A.y * B.y; }
double Length(Vector A){ return sqrt(Dot(A,A)); }
double Angle(Vector A, Vector B){ return acos(Dot(A, B) / Length(A) / Length(B)); }
inline Vector Rotate(Vector A, double rad){ return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) + A.y * cos(rad)); }
inline Point intersection_ll(Line a,Line b){ Vector u = a.p - b.p; double t = cross(b.v, u) / cross(a.v, b.v); return a.p + a.v * t; }
Point getD(Point A, Point B, Point C){ Vector v1 = C - B; double a1 = Angle(A - B, v1); v1 = Rotate(v1,a1 / 3); Line l1 = Line(B,v1);
Vector v2 = B - C; double a2 = Angle(A - C, v2); v2 = Rotate(v2,-a2 / 3); Line l2 = Line(C,v2);
return intersection_ll(l1,l2); }
int main(){ int t; cin >> t; Point A,B,C,D,E,F; while (t --){ A.read_point(); B.read_point(); C.read_point(); D = getD(A,B,C); E = getD(B,C,A); F = getD(C,A,B); printf("%.6lf %.6lf %.6lf %.6lf %.6lf %.6lfn",D.x, D.y, E.x, E.y, F.x, F.y); } return 0; }
|