yt.utilities.math_utils.
get_rotation_matrix
(theta, rot_vector)[source]¶Given an angle theta and a 3D vector rot_vector, this routine computes the rotation matrix corresponding to rotating theta radians about rot_vector.
Parameters: | theta : scalar
rot_vector : array_like
|
---|---|
Returns: | rot_matrix : ndarray
|
See also
Examples
>>> a = [0,1,0]
>>> theta = 0.785398163 # pi/4
>>> rot = mu.get_rotation_matrix(theta,a)
>>> rot
array([[ 0.70710678, 0. , 0.70710678],
[ 0. , 1. , 0. ],
[-0.70710678, 0. , 0.70710678]])
>>> np.dot(rot,a)
array([ 0., 1., 0.])
# since a is an eigenvector by construction
>>> np.dot(rot,[1,0,0])
array([ 0.70710678, 0. , -0.70710678])