407543: GYM102823 L Two Ants
Description
There are two ants landing on an infinite ground containing two chocolate sticks, one white and one black. However, they do not know the accurate position of each other.
"Where are you?", Ant A shouted.
"I don't know. But from my own view I can see the white stick only!", Ant B replies.
"Well I cannot get your accurate position but I know where you may be!", Ant A says.
If two sticks can be regarded as segments which exclude the endpoints and share no more than one common point, can you guess where Ant B may be? Print the total area of that instead.
InputThe first line of input file contains only one integer $$$T$$$ ($$$1\le T \le 1000$$$) indicating the number of test cases.
Then there are $$$T$$$ lines followed, with one test case each line.
For each test case, there are eight integers $$$x_w, y_w, X_w, Y_w, x_b, y_b, X_b, Y_b$$$ ranging in $$$[-1000,1000]$$$. The white one is represented by its two endpoints' positions $$$(x_w, y_w), (X_w, Y_w)$$$ and the black one is represented by its two endpoints' positions $$$(x_b, y_b), (X_b, Y_b)$$$.
OutputPrint $$$T$$$ lines exactly.
For each line, please output Case $$$d$$$: ($$$d$$$ represents the order of test case) first and then the answer, whose absolute error should be less than $$$10^{-6}$$$ . If that area is infinite, print inf as answer instead.
ExampleInput3Output
0 0 0 1 0 0 1 0
0 0 1 0 0 1 0 -1
1 1 1 2 0 0 0 3
Case 1: infNote
Case 2: 0.000
Case 3: 0.2500000000
Sample 3:
Only the area $$$S$$$ meets the requirement and its total area is $$$0.25$$$.