Rotations in 3 Dimensions

View as PDF

Submit solution

Points: 12
Time limit: 1.0s
Memory limit: 256M

Problem type

Your task is simple: given some points in 3D, rotate them around an axis of rotation.

Input Specification

The first line of input will contain T, the number of test cases (1T1000).
The next T lines will each contain 7 real numbers to 6 decimal places, x y z rx ry rz θ. You are to rotate the point (x,y,z) around the axis of rotation (rx,ry,rz) such that if you look at the origin from the axis of rotation, it will be rotated θ radians counterclockwise. All coordinates will have absolute value of at most 1000 and θ will be such that 0θ<2π. It is guaranteed at least one of rx,ry,rz is nonzero.

Output Specification

Output T lines, each line should have the (x,y,z), the result of rotation as three space-separated real numbers. Your answer will be judged as correct if it is within an absolute or relative error of 106.

Sample Input

Copy
2
0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 3.141593
1.000000 0.000000 0.000000 1.000000 1.000000 1.000000 1.570796

Sample Output

Copy
0.000000 0.000000 0.000000
0.333334 0.910683 -0.244017

Comments

There are no comments at the moment.