This is the 3rd problem from the series created by Kevin Bodurtha - many thanks!
With your assistance in calculating molecule rotations in Methane Rotation, the R&D team at the Methane Factory has confirmed that their "Molecule Rotator" machine works! Now they can start utilizing their machine to truly start performing some research.
The idea is to use the machine to re-orient a Methane molecule from some initial orientation into any desired
orientation, to influence the outcomes of chemical reactions. Using a degrees-of-freedom analysis, the engineers
on the R&D team determine that such a re-orientation could be done using as few as 2
rotations along some 2
chosen axes.
However, they're not entirely sure how to determine exactly what those 2
rotations should be for any given set
of orientations. They hand the problem over to you, asking you to create a program to solve it for them.
For simplicity, you will be expected to provide rotations which bring the 4
points to the following XYZ
coordinates:
(0, 0, 109)
(109 * sqrt(8/9), 0, -109/3)
(-109 * sqrt(2/9), 109 * sqrt(2/3), -109/3)
(-109 * sqrt(2/9), -109 * sqrt(2/3), -109/3)
The laser beam will be fired from the coordinates (Lx, Ly, Lz)
, aimed directly at the origin (0, 0, 0)
.
To work properly, the laser must be positioned at a total distance of between 1000
and 1000000
picometers.
The 4
points will then rotate Theta
degrees around the axis of the laser, clockwise when viewed along the path
of the ray.
Input data will consist of 12
space-separated decimal values corresponding to the initial coordinates of
the 4
points, given in the format x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4
.
Answer should consist of two sets of 4
values each. The first 3
values of each set correspond
Lx, Ly, Lz
, and the 4-th
value is Theta
in degrees. Thus, each set corresponds to one applied rotation.
Answers will be checked server-side to confirm that the rotations given actually move the points to the desired locations. Note that points are indistinguishable from each other, so ordering does not matter: any of the four points can be in any of the desired positions, as long as there is one point in each desired position.
Example
input data (with linebreaks for better visibility):
53.515059 94.78123 5.801456
-10.026568 -29.733435 -104.385779
-98.981915 11.397435 44.20044
55.493424 -76.44523 54.383883
answer:
-167197 -131614 977098 -231 -601696 -722477 340568 -111