Missing triangle P32572


Statement
 

pdf   zip

html

Dirby just draw a triangle with red ink, and then he draw its circumscircle and its incircle with blue ink. However, he spilled some water into his drawing and unfortunately the red ink disappeared. Dirby is too lazy to make another drawing, so he wants to reconstruct the triangle given the two circles. Since he is not too good in geometry, he wants you to do this task for him. Can you?

Input

Input consists of several cases, each one with six real numbers x1, y1, r1, x2, y2 and r2, which indicate the center and the radius of the circumcircle and of the incircle, respectively. You can assume that he incircle is inside the circumcircle, that the coordinates do not exceed 1000 in absolute value, and that they have at most 8 decimal digits. No given case is ill-conditioned.

Output

For every case, print with 8 digits after the decimal point the coordinates x, y of the vertices of a triangle that has the desired circumcircle and incircle, all separated by spaces. If there is more than one solution, print any of them. If there is no solution, print “impossible”.

Observations

Calculate using the long double type. Solutions that fulfill the mathematical conditions with a “reasonable small” error will be accepted. Similarly, assume that a solution is possible when the distances the the circles are “small enough”. For this problem, the judge will use a huge ε = 10−4.

Public test cases
  • Input

    4 3 5 2 2 2
    4 3 5 2 2 2.5
    

    Output

    0.00000000 0.00000000 8.00000000 0.00000000 0.00000000 6.00000000
    impossible
    
  • Information
    Author
    Ivan Geffner
    Language
    English
    Official solutions
    C++
    User solutions
    C++
    Event
    Dotzè Concurs de Programació de la UPC - Semifinal
    Date
    2014-07-02