Given an ellipse’s two foci and the length of its major axis, determine the coordinates of the tightest axis-aligned bounding box that can block out that ellipse.
The single line of input contains five integers $x_1$, $y_1$, $x_2$, $y_2$ ($-100 \le x_1,y_1,x_2,y_2 \le 100$) and $a$ ($\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \le a \le 1\, 000$), where the two foci of the ellipse are at $(x_1,y_1)$ and $(x_2,y_2)$ and the length of the major axis is $a$ (Note that’s the major axis, not the semi-major axis or the major radius).
Output four space-separated real numbers on a single line. The numbers, in order, are $x_{\text {low}}$, $y_{\text {low}}$, $x_{\text {high}}$, $y_{\text {high}}$, where $(x_{\text {low}},y_{\text {low}})$ is the lower left corner of the tightest bounding box of the ellipse, and $(x_{\text {high}},y_{\text {high}})$ is the upper right corner of the tightest bounding box of the ellipse. Each output will be considered correct if it is within an absolute or relative error of $10^{-4}$.
Sample Input 1 | Sample Output 1 |
---|---|
-5 0 5 0 16 |
-8.000000 -6.244998 8.000000 6.244998 |
Sample Input 2 | Sample Output 2 |
---|---|
51 23 19 67 70 |
7.778685 13.871235 62.221315 76.128765 |