Railgun
-------
Its URGENT! You MUST get a message to the Princess!
She's in the station on the other side of the twin
suns, and because of the suns, you cannot get an
electromagnetic or photonic message through to her.
You must use a message capsule fired from a rail gun.
The velocity of the capsule just after it is fired from
the rail gun is fixed. The good news is that both you
and the Princess's station are holding constant position
relative to the suns, and the velocity is fast enough
that the path of the message capsule will be close to
the straight line between you and the Princess.
The suns are of course rotating about each other, and
as you and the Princess are fixed relative to the
suns, the coordinate system you are using is rotating
with the suns. Therefore there are Coriolis, centri-
fugal, and Euler forces that are not negligible.
However, you are to IGNORE THESE (treat them as zero),
as they significantly slow the computation and thus make
judging more difficult.
Input
-----
A sequence of test cases. Each test case has four
lines of the form:
TEST-CASE-NAME
M1 X1 M2 X2
X3 Y3 Z3 X4 Y4 Z4
V D
The first line is a test case name line, that has at
most 80 characters. The other lines contain the
floating point numbers defined as follows:
M1 is the mass of sun 1, and (X1,0,0) is its center
M2 is the mass of sun 2, and (X2,0,0) is its center
(X3,Y3,Z3) is your position
(X4,Y4,Z4) is the Princess's station position
V is the capsule velocity when it leaves the rail gun
D is the distance within which the capsule must come
to the Princess's station in order for the station
to capture the capsule
Units are kilograms, meters, meters per second.
Coordinates are chosen so that (0,0,0) is the center
of gravity of the 2-sun system, that is,
M1*X1 + M2*X2 = 0
Acceleration caused by the gravity of a sun is
G*M/R**2 pointed at the center of the sun
where M is the mass of the sun, R the distance to the
sun, and
G = 6.67408e-11 m**3/(kg*sec**2)
All spacial coordinates are in the range [-1e15,+1e15]
meters and masses are in the range [1e30,1e32] kilo-
grams. V will be large enough to get the capsule to the
Princess within 1e4 seconds (3 hours). D will be in the
range [1e3,1e5].
Input ends with an end of file.
Output
------
For each test case, first an exact copy of the test case
name line. Then just one line of the form
VX VY VZ
giving the initial velocity of capsule. To be judged
correct, the numbers should be output with 10 digits of
precision.
The capsule must go to the Princess's station without
going completely around either sun. The capsule must
come within D meters of the Princess's station, and the
total initial velocity, sqrt (VX**2 + VY**2 + VZ**2),
must be within 0.0001% of V.
There will of course be many slightly different solu-
tions; any one will do.
Display
-------
There is an interactive display command that may help
you visualize the problem. To see its documentation
use
display_trajectory -doc
and to run it use
display_trajectory sample.in
replacing sample.in with any test case input file.
The display command requires X windows.
Sample Input
------ -----
-- SAMPLE 1 --
1e30 -1e10 1e30 +1e10
2e10 1e10 +2.0e9 0 -1e10 +5.0e9
5e6 1e4
-- SAMPLE 2 --
1e30 -1e10 1e30 +1e10
-0.99e10 1e10 0 -0.99e10 -1e10 0
1e7 1e4
Sample Output
------ ------
-- SAMPLE 1 --
-3515346.385 -3515696.573 531241.3722
-- SAMPLE 2 --
45647.43196 -9999895.815 0.01604674784
File: railgun.txt
Author: Bob Walton
Date: Tue Oct 15 05:05:25 EDT 2019
The authors have placed this file in the public domain;
they make no warranty and accept no liability for this
file.