Forming an Equilateral Triangle
You are given three non-collinear points A,B,C. Find the point that forms an equilateral triangle with point A and reflection of A with respect to the line BC. i.e., let reflection of A with respect to BC be A’. Then, find a point D such that ADA’ forms an equilateral triangle .
Input :
The first line the contains number of test cases t.
The next t lines contains 6 integers x1,y1, x2, y2,x3,y3 representing co-ordinates of A(x1,y1),B(x2,y2),C(x3,y3) .
Output : You should output t lines each containing two space separated real numbers a,b representing the point D(a,b).
The absolute value of difference between any two sides of triangle ADA' should be less than 10^-9.
If there are multiple answers print the point which is close to C.
Constraints :
Sub-task 0(1 point):
1<=t<=20
1<=a,b<=10^9
Sub-task 1(2 points):
1<=t<=200
1<=a,b<=10^9
Sub-task 2(7 points):
1<=t<=4000
1<=a,b<=10^9
Sample Test Case 1:
Input:
3
1 7 4 0 9 4
8 8 2 4 5 5
1 7 1 1 5 2
Output:
15.51297 9.21038
5.48231 5.16077
12.19276 3.79819
Sample Test Case 2:
Input:
3
1 0 0 1 0 -1
1 0 3 3 9 9
0 1 1 0 3 0
Output:
0.00000 -1.73205
1.36603 1.36603
1.73205 0.00000
Comments