The DoD company has contractod to determine under what conditions a pair of scanner robots can collide. The robots are fired simultaneously from ``guns" that are mounted near opposite ends of a horizontal strip. They travel in straight lines until they hit a wall of the strip or until they are in the same spot at the approximately the same time.
Whenever a robot hits a wall, it bounces off without loss of speed and in a straight line so that the angle of incidence equals the angle of reflection.
If the robots are in the same spot at approximately the same time, then they ``collide."
Write a program to determine whether robots collide and if so where. To simplify the computer model of the physical problem, assume the following.
- The horizontal strip is 2-dimensional, and it runs left-to-right. Its walls are straight lines.
- Each robot is a point mass. That is, the circumference of each robot is 0.
- A robot maintains the speed with which it was originally fired until it collides with the other robot or until it passes the gun from which the other robot was fired.
- There are 2 guns, one mounted to the left of the other on a horizontal strip. The initial angle of the left gun is between -85 and 85 . The initial angle of the right gun is between 95 and 180 or -95 and -180 . (All angles are measured counterclockwise from the positive x-axis.)
- Robots collide when they pass through the same place within 0.5 second of each other.
- The horizontal strip is 10 units high. For any point (x,y) in the strip, .
- Robots speeds will be positive.
Input for your program is a text file which contains data for several different pairs of robots. The lines of the text file come in pairs. The first line of a pair gives initial firing information about the robot fired from the leftmost gun. The second line of the pair gives initial firing information about the robot fired from the rightmost gun. Each line contains 4 data items as follows:
x-coordinate y-coordinate angle speed
(all values are real numbers, angle is in degrees)
The end of input is indicated by end-of-file. Assume that the input is error-free.
To help maintain floating point accuracy when converting degrees to radians, use the predeclared constant pi.
For each robot problem, output from your program should consist of the number of the problem (ex: Robot problem #1, Robot problem #2), colon and a statement indicating whether or not the robots do collide. If they do collide, your prograrn should also print the coordinates of the point of collision. If the robots collide multiple times, write the coordinates of collision point with shortest passing interval. If there're many of such points, write the one with lowest x coordinate. All real output should be printed with 2 digits to the right of the decimal.
0 4 0 3.3 40 5 125 5 1 6 -5 10 5 2 95 20 2 5 45 5 42 5 -135 5 0 6 20 3 0 5 180 4
Robot Problem #1: Robots do not collide. Robot Problem #2: Robots collide at (4.68,5.68). Robot Problem #3: Robots collide at (22.00,5.00). Robot Problem #4: Robots do not collide.