rotate#

Rodrigues.rotate(axis: ndarray | Vector3d | None = None, angle: List[float] | float | ndarray = 0) Vector3d[source]#

Convenience function for rotating this vector.

Shapes of axis and angle must be compatible with shape of self for broadcasting.

Parameters:
axis

The axis of rotation. Defaults to the z-vector.

angle

The angle of rotation, in radians.

Returns:
v

A new vector with entries rotated.

Examples

>>> from orix.vector import Vector3d
>>> v = Vector3d.yvector()
>>> axis = Vector3d((0, 0, 1))
>>> angles = [0, np.pi / 4, np.pi / 2, 3 * np.pi / 4, np.pi]
>>> v.rotate(axis=axis, angle=angles)
Vector3d (5,)
[[ 0.      1.      0.    ]
 [-0.7071  0.7071  0.    ]
 [-1.      0.      0.    ]
 [-0.7071 -0.7071  0.    ]
 [-0.     -1.      0.    ]]