euler_matrix

odl.tomo.util.utility.euler_matrix(phi, theta=None, psi=None)[source]

Rotation matrix in 2 and 3 dimensions.

Its rows represent the canonical unit vectors as seen from the rotated system while the columns are the rotated unit vectors as seen from the canonical system.

Parameters
phifloat or array-like

Either 2D counter-clockwise rotation angle (in radians) or first Euler angle.

theta, psifloat or array-like, optional

Second and third Euler angles in radians. If both are None, a 2D rotation matrix is computed. Otherwise a 3D rotation is computed, where the default None is equivalent to 0.0. The rotation is performed in “ZXZ” rotation order, see the Wikipedia article Euler angles.

Returns
matnumpy.ndarray

Rotation matrix corresponding to the given angles. The returned array has shape (ndim, ndim) if all angles represent single parameters, with ndim == 2 for phi only and ndim == 3 for 2 or 3 Euler angles. If any of the angle parameters is an array, the shape of the returned array is broadcast(phi, theta, psi).shape + (ndim, ndim).

References