rotate#

VectorArray.rotate(angle_rad, axis)[source]#

Rotate vectors by angle_rad around axis

Rotates counter-clockwise in a right-handed coordinate system, where the axis around which is rotated points towards the obsorver.

Parameters:
angle_radfloat

The rotation angle(s) in radian.

If multiple angles are provided, rotate each vector with by the corresponding angle.

axisVector

The axis around which the vector is rotated.

E.g., axis = Vector(0, 0, 1) will rotate the vector around the z-axis, that is, within the xy-plane.

So far, axis must be along x, y, or z-direction.

Returns:
rotated_vectorVector

Examples

vec = ap.VectorArray([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
vec.rotate(np.pi / 2.0, (0, 0, 1))
VectorArray([[ 0. 1. 0.]
             [-1. 0. 0.]
             [ 0. 0. 1.]])
vec = ap.VectorArray([[1, 0, 0], [0, 1, 0]])
vec.rotate((np.pi / 2.0, np.pi), (0, 0, 1))
VectorArray([[0.  1. 0.]
             [1. -1. 0.]
             [0.  0. 1.]])