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 defaultNone
is equivalent to0.0
. The rotation is performed in “ZXZ” rotation order, see the Wikipedia article Euler angles.
- phifloat or
- Returns
- mat
numpy.ndarray
Rotation matrix corresponding to the given angles. The returned array has shape
(ndim, ndim)
if all angles represent single parameters, withndim == 2
forphi
only andndim == 3
for 2 or 3 Euler angles. If any of the angle parameters is an array, the shape of the returned array isbroadcast(phi, theta, psi).shape + (ndim, ndim)
.
- mat
References