rotate#
- Quaternion.rotate(a: ndarray) ndarray #
Rotate array \(\mathbf{a}\) through quaternion \(\mathbf{q}\).
- Parameters:
a (numpy.ndarray) – 3-by-N array to rotate in 3 dimensions, where N is the number of vectors to rotate.
- Returns:
a’ – 3-by-N rotated array by current quaternion.
- Return type:
numpy.ndarray
Examples
>>> q = Quaternion([-0.00085769, -0.0404217, 0.29184193, -0.47288709]) >>> v = [0.25557699 0.74814091 0.71491841] >>> q.rotate(v) array([-0.22481078 -0.99218916 -0.31806219]) >>> A = [[0.18029565, 0.14234782], [0.47473686, 0.38233722], [0.90000689, 0.06117298]] >>> q.rotate(A) array([[-0.10633285 -0.16347163] [-1.02790041 -0.23738541] [-0.00284403 -0.29514739]])