Missing triangle

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 x₁, y₁,
r₁, x₂, y₂ and r₂, which indicate the center and the radius of the
circumcircle and of the incircle, respectively. You can assume that the
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⁻⁴.

Problem information

Author: Ivan Geffner

Generation: 2026-01-25T10:16:02.580Z

© Jutge.org, 2006–2026.
https://jutge.org
