Morley’s Theorem

Morleys theorem states that that the lines tri- secting the angles of an arbitrary plane triangle meet at the vertices of an equilateral triangle. For example in the figure below the tri-sectors of angles A, B and C has intersected and cre- ated an equilateral triangle DEF. Of course the theorem has various gener- alizations, in particular if all of the tri-sectors are intersected one obtains four other equilat- eral triangles. But in the original theorem only tri-sectors nearest to BC are allowed to inter- sect to get point D, tri-sectors nearest to CA are allowed to intersect point E and tri-sectors nearest to AB are intersected to get point F. Trisector like BD and CE are not allowed to intersect. So ultimately we get only one equilateral triangle DEF. Now your task is to find the Cartesian coordinates of D, E and F given the coordinates of A, B, and C. Input First line of the input file contains an integer N (0 < N < 5001) which denotes the number of test cases to follow. Each of the next lines contain six integers XA , YA , XB , YB , XC , YC . This six integers actually indicates that the Cartesian coordinates of point A, B and C are (XA,YA),(XB,YB) and (XC,YC) respectively. You can assume that the area of triangle ABC is not equal to zero, 0 ≤ XA,YA,XB,YB,XC,YC ≤ 1000 and the points A, B and C are in counter clockwise order. Output For each line of input you should produce one line of output. This line contains six floating point numbers XD,YD,XE,YE,XF,YF separated by a single space. These six floating-point actually means that the Cartesian coordinates of D, E and F are (XD,YD),(XE,YE) ,(XF,YF) respectively. Errors less than 10−5 will be accepted. Sample Input 2 112212 0 0 100 0 50 50 Sample Output 1.316987 1.816987 1.183013 1.683013 1.366025 1.633975 56.698730 25.000000 43.301270 25.000000 50.000000 13.397460