def rotation_matrix_3D(u, th):
<EOL>u = normalize(u)<EOL>a = math.cos(<NUM_LIT:0.5> * th)<EOL>s = math.sin(<NUM_LIT:0.5> * th)<EOL>(b, c, d) = -s * u<EOL>(a2, b2, c2, d2) = (a*a, b*b, c*c, d*d)<EOL>(bc, ad, ac, ab, bd, cd) = (b*c, a*d, a*c, a*b, b*d, c*d)<EOL>return np.array([[a2 + b2 - c2 - d2, <NUM_LIT:2>*(bc + ad),         <NUM_LIT:2>*(bd - ac)],<EOL>[<NUM_LIT:2>*(bc - ad),       a2 + c2 - b2 - d2,   <NUM_LIT:2>*(cd + ab)],<EOL>[<NUM_LIT:2>*(bd + ac),       <NUM_LIT:2>*(cd - ab),         a2 + d2 - b2 - c2]])<EOL>
rotation_matrix_3D(u, t) yields a 3D numpy matrix that rotates any vector about the axis u
t radians counter-clockwise.