rotate#

ReciprocalLatticeVector.rotate(*args, **kwargs)[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:

A new vector with entries rotated.

Return type:

vec

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.    ]]