Composite Transformations

Given n points and m planes in 3D place, you will need to perform t transformations on them, and then calculate their final states. By “transforming a plane”, we mean transforming all the points on that plane. There are three kinds of transformations (in the text below, P means the point being transformed): TRANSLATE a b c If P’s position was (x,y,z), it becomes (x+a,y+b,z+c) after the transformation. ROTATE a b c theta P is rotated. The rotation axis is vector (a, b, c), the angle of rota- tion is theta degrees. The rotation follows the right-hand rule, so if the vector (a,b,c) points toward you, the rotation will be counter- clockwise from your point of view. The rotation axis always passes through (0, 0, 0). SCALE a b c If P’s position was (x,y,z), it becomes (ax,by,cz) after the trans- formation. This problem uses right-hand coordinate system: Input There will be only one test case, beginning with three integers n, m, t (1 ≤ n, m ≤ 50, 000, 1 ≤ t ≤ 1, 000). Next n lines contain the coordinates of each point. Next m lines contains four integers a, b, c, d to describe a plane ax + by + cz + d = 0 (at least one of a, b, c will be non-zero). Next t lines contain the operations. All the input coordinates and parameters a, b, c, d are real numbers with absolute values not larger than 10. These input real numbers will have at most two digits after the decimal point. Parameter theta is an integer between 0 and 359 (inclusive). Output For each point, print three real numbers x, y, z on a single line. For each plane, print four real numbers a, b, c, d on a single line. To avoid floating-point issues, a2 + b2 + c2 must be 1, but if there is more than one choice of (a, b, c, d) to represent the answer, anyone is acceptable. Output each real number to two decimal places. To reduce the impact of floating-point errors, each number you print could differ from the standard output by up to 0.05. Sample Input 113 123 0 0 1 -2 TRANSLATE 2 3 4 ROTATE 1 0 0 90 SCALE 3 2 1

2/2 Sample Output 9.00 -14.00 5.00 0.00 1.00 0.00 12.00