rotateVector

pyvsim.Utils.rotateVector(x, angle, axis)[source]

This implementation uses angles in degrees. The algorithm is the vectorized formulation of the Euler-Rodrigues formula

Parameters :

x : numpy.ndarray \((N,3)\)

A vector or a list of vectors (N rows, 3 columns) to be rotated

angle : double

scalar (in radians)

axis : numpy.ndarray \((3)\)

A vector around which the vector is rotated

Returns :

vectors : numpy.ndarray \((N,3)\)

The vectors after rotation

Examples

>>> [x,y,z] = np.eye(3)
>>> temp = rotateVector(x, np.pi/2, z)
>>> aeq(temp, y)
True

This works also for lists of vectors:

>>> X = np.tile(x,(100,1))
>>> Y = np.tile(y,(100,1))
>>> Z = np.tile(z,(100,1))
>>> temp = rotateVector(X, np.pi/2, Z)
>>> aeq(temp, Y)

True

This Page