numpy中的球坐标生成四元数 [英] quaternion creation by spherical coords in numpy
问题描述
在尝试了解numpy的四元数扩展名的用法时,我看到了
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))
打印出
(quaternion(0.866025403784439, -0, 0.5, 0))
此四元数是围绕Y轴旋转60度,但我预计由于phi是0.0,所以只能围绕Z轴旋转60度.关于源文件,theta和phi是否已更改,或者我丢失了某些内容?
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?
感谢您的帮助.
推荐答案
您对四元数的理解是完全正确的.但是我想也许您对在球坐标系中使用theta
和phi
感到困惑.
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.
在此处查看图片,此约定是众所周知的.对于theta = 60
,phi = 0
,该点位于zx平面中,与z轴成60度角.因此,您确实需要绕y轴旋转60度才能将北极传输到该点.
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.
这篇关于numpy中的球坐标生成四元数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!