quaternion creation by spherical coords in numpy

回眸只為那壹抹淺笑 提交于 2019-12-11 06:01:56

问题


While trying to understand the usage the quaternion extension of numpy, I saw that

import numpy as np
import quaternion as q

theta = np.pi * 1.0 / 3.0
phi = 0.0

print(q.from_spherical_coords(theta,phi))

prints out

(quaternion(0.866025403784439, -0, 0.5, 0))

This quaternion is a 60 degrees rotation around Y axis, but I expected a 60 degrees rotation around Z axis only, since phi is 0.0. Have theta and phi changed with respect to source files or am I missing something?

Thanks for any help.


回答1:


Your understanding to quaternion is totally correct. But I think maybe you are confused by how theta and phi are used in spherical coordinate system.

See the picture here, this convention is well-known. For theta = 60, phi = 0, the point is located in zx-plane with a 60 degree angle to z-axis. Thus you do need a rotation around y-axis by 60 degree to transport the north-pole to this point.



来源:https://stackoverflow.com/questions/48487278/quaternion-creation-by-spherical-coords-in-numpy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!