In this problem, you are given a tetrahedron in -dimensional space. A tetrahedron is defined as “a solid having four plane triangular faces; a triangular pyramid.” You are given the coordinates of 4 vertices of a tetrahedron in -dimensional space. It is guaranteed that the first out of of these points are situated in a plane parallel to the plane. Let’s call this plane the base of the tetrahedron. Let’s call the 4th point the apex of this tetrahedron. It is also guaranteed that the center of mass of this tetrahedron is the origin of this coordinate system.
Now, let’s go through some steps to transform this tetrahedron:
Mirror the tetrahedron with respect to the plane. Mirroring a point with respect to a plane in 3d space will generate a new point such that the plane bisects the straight line and the line is perpendicular to the plane. For example, mirroring the point with respect to the plane gives a new point . The straight-line is bisected by the plane at and the line is perpendicular on the plane.
After mirroring, multiply each coordinate with a factor . This will effectively scale the tetrahedron by this factor .
Now, translate the transformed and scaled tetrahedron only along the -axis (the and coordinates remain unchanged) so that the new position of the apex point is in the same plane containing the original base plane. ( In Euclidean geometry, a translation is a transformation that moves every point of a shape by the same distance in a given direction)
Now, depending on the value of the transformed tetrahedron might or might not fit inside the original tetrahedron. If none of the points of the transformed tetrahedron is situated outside the original tetrahedron, then it is said that the transformed tetrahedron fits perfectly inside the original tetrahedron. On the other hand, if even a single point of the transformed tetrahedron is situated outside the original tetrahedron, then it cannot be said to perfectly fit inside. Your job is to find the biggest value of for which the transformed tetrahedron fits perfectly inside the original tetrahedron. Notice it is possible that after applying the necessary transformations, the modified tetrahedron will never fit inside the original tetrahedron. In this case, the value of k will be 0.
The input will start with an integer (), which stands for the number of test cases.
This will be followed by test cases. Each test case will have lines describing the vertices of a tetrahedron. Each line contains space-separated real numbers corresponding to the , , and -axis coordinates of that vertex.
You can safely assume that the input tetrahedron will be non-degenerate (the volume will never be 0).
For each test case, print the value of the scaling factor , in a newline. Errors less than will be ignored.
Input | Output |
---|---|
2 3 3 -3 -1 -5 -3 -2 2 -3 0 0 9 3 3 -3 -2 -5 -3 -2 1 -3 1 1 9 | 0.5 0.4 |