Pedro Pacoca enjoys playing an online car racing game and recently discovered that his colleague Pedro Gallo also plays the game. Excited by this, the two Pedros decided to help each other.
In the game, each player drives a car around a circuit, and the player who completes the course in the shortest time wins. To achieve this, it is crucial for players to avoid crashing their cars into others.
Knowing this, the two Pedros decided to share the initial positions of their cars, their speeds, and the directions they were moving. They also agreed to maintain both their speeds and directions constant.
Now, they need your help to determine if there will be a collision between the two cars. Given the initial positions and the speeds in the $$$x$$$ and $$$y$$$ directions for each car, determine the moment in time when a collision will happen. If no collision occurs, output $$$-1$$$.
For the purposes of collision detection in this problem, each car is modeled as a triangle on the plane.
The input consists of four lines. The first two lines describe the first car, and the last two lines describe the second car.
Each car is described by two lines:
It is guaranteed that the provided vertices form a non-degenerate triangle. Furthermore, it is also guaranteed that collision triangles do not intersect. That is, there is no point $$$p$$$ that belongs to both triangles simultaneously.
Print a single line containing a real number: the moment in time when a collision will occur between the cars, or $$$-1$$$, if there is no collision.
Your answer will be considered correct if the absolute or relative error does not exceed $$$10^{-6}$$$.
0 0 1 0 0 1 1 0 1 1 2 1 1 2 0 -1
0.5
0 0 1 0 0 1 1 0 5 0 5 -1 4 0 -3 0
0.75
2 2 2 0 7 3 4 2 3 3 8 7 10 8 1 0
-1