#P8718. Exploring the Safe Zone on the Island
Exploring the Safe Zone on the Island
Exploring the Safe Zone on the Island
Scientist XiaoLan has arrived on a deserted island defined by a triangle with vertices ( (x_{1}, y_{1}) ), ( (x_{2}, y_{2}) ), and ( (x_{3}, y_{3}) ). He has installed a transmitter at ( (x_{A}, y_{A}) ) and a receiver at ( (x_{B}, y_{B}) ). Using a mobile device, the positioning system works properly if the sum of the distances from the transmitter to the mobile device and from the mobile device to the receiver is at most ( L ); that is, if [ d(P, F_1)+d(P, F_2)\le L, ] where the foci ( F_1=(x_{A},y_{A}) ) and ( F_2=(x_{B},y_{B}) ). Otherwise the system malfunctions. For safety, XiaoLan only surveys areas where the device works normally.
Your task is to compute the area of the island (the triangle) in which the positioning device works normally. Note that the transmitter and receiver may be outside the island, and if ( L ) is less than the distance between the foci, the safe zone will be empty.
A useful observation: The inequality ( d(P, F_1) + d(P, F_2) \le L ) defines an ellipse with foci ( F_1,F_2 ) and major axis length ( L ). Thus the safe region is the intersection between the triangle and this ellipse.
inputFormat
Input consists of two lines. The first line contains five real numbers: ( x_{A}; y_{A}; x_{B}; y_{B}; L ). The second line contains six real numbers: ( x_{1}; y_{1}; x_{2}; y_{2}; x_{3}; y_{3} ), representing the coordinates of the triangle's vertices.
outputFormat
Output a single real number representing the area of the safe region (i.e. the intersection of the triangle and the ellipse). The answer is accepted if it has an absolute or relative error of at most (10^{-6}).
sample
0 0 10 0 15
2 2 3 2 2 3
0.5
</p>