1373 - Projection

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 7

Solved: 3

Description
Give two segments AB and CD in 3D space, if I choose a plane arbitrarily, what is the probability that the projection of the above two segments on that plane intersects?
Input
The input contains multiple cases each containing only one line.
XA YA ZA XB YB ZB XC YC ZC XD YD ZD
——the coordinates of end points.
All values are integers in [-100, 100].
It is guaranteed that AB and CD have no common points.
Output
For each case output the probability mentioned, accurate to five digits after the dot.
sample input
0 -100 0 0 100 0 -100 0 1 100 0 1
0 -1 0 0 1 0 -1 0 1 1 0 1
0 -10 0 0 10 0 -10 0 100 10 0 100
sample output
0.99100
0.33333
0.00630
hint
Don’t output -0.00000.
source
Hust Monthly 10.06.13/Han XU
© 2015 HUST ACMICPC TEAM. All Right Reserved.