This page is still under construction.

Parts of this page are still being built. What you see may change.

Brocard Point

Time limit2sMemory limit512 MB

Summary
Given the coordinates of a triangle's vertices in anticlockwise order, compute the coordinates of its Brocard point and print them to five decimal places.
Level

Medium7 of 10

Topics
Geometry, Math, Implementation, Brute force
Solved
No attempts yet

Problem

Label the vertices of a triangle in anticlockwise order as A, B and C. Inside triangle ABC there is exactly one point P with ∠PAB=∠PBC=∠PCA\angle PAB = \angle PBC = \angle PCA. That point is called the Brocard point.

Given the coordinates of A, B and C, write a program that computes the coordinates of the Brocard point of triangle ABC.

Input

The first line contains the number of test cases tt (1≤t≤100001 \le t \le 10000).

Each of the next tt lines contains six space separated real numbers xAx_A, yAy_A, xBx_B, yBy_B, xCx_C, yCy_C. Every coordinate has absolute value at most 10001000 and at most six digits after the decimal point. The three points are not collinear and are given in anticlockwise order.

Output

For each test case, print the xx coordinate and the yy coordinate of the Brocard point on one line, separated by a space, each rounded to five decimal places. Always print all five digits after the decimal point. If a rounded coordinate is zero, print 0.00000 with no sign.

Examples2

  1. Example 1

    Input
    3
    0 -1.3 3.4 0.5 1.1 2.3
    0 0 3 0 0 4
    3.1 0.2 4.3 0.4 0 0.8
    
    Expected output
    1.40456 0.82890
    1.56047 0.74902
    3.87699 0.40167
    
  2. Example 2

    Input
    2
    -2 -1.373127 5 -1.873127 1 3.626873
    0 0 6 0 3 2
    
    Expected output
    0.90164 0.00000
    2.18824 0.84706