shunfurh 于 2017.09.08 09:26 提问

Distance and Speed Testing

There are two round tracks intersecting at point A(a_x,a_y) and B(b_x,b_y), where a_y > b_y. The coordinate of the centers of the two tracks are (x1,y1) and (x2,y2). To simplify the problem, we assume that neither centers of tracks is in another track. That is the distances between two centers are longer than max(r1,r2). Now there are tow cars each running on one track (of course in different tracks) with the same direction (both in anticlockwise or both in clockwise) starting from A. After one loop we find they arriving at A at the same time. From geometry theorem we know there is always a fixed point P, from which the tow distances to the two cars are equal at any time. That is, assuming that d1 is the distance between P and one car ,d2 is the distance between P and another car, if the speeds of the tow cars neither change, d1=d2 satisfies at any time. Then if we find the two distances are not equal, we can make a conclusion that the speed of the tow cars changes(may be one or both change). Your task is to calculate the exact position of P, given the two round tracks' position and radius.

Input

In the first line of the input there is a number 1<= N <= 20 indicating the number of cases. Then following N lines, each line defining one case. Each line include 6 integers x1, y1, r1, x2, y2, r2, where x1, y1, r1, represent the first circle's x-coordinate, y-coordinate and radius while x2, y2, r2 represent the second circle. They are separated by one space. All integers are between (-10,10).

Output

For each case ,output the coordinate of point p in one line in this format: (x,y).

Sample Input

2
-1 0 2 1 0 2
-3 3 4 -6 6 3

Sample Output

(0.00,1.73)
(-2.00,5.83)

1个回答

caozhy      2017.09.23 23:25