numpy中的球坐标生成四元数 [英] quaternion creation by spherical coords in numpy

查看:230
本文介绍了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?

感谢您的帮助.

推荐答案

您对四元数的理解是完全正确的.但是我想也许您对在球坐标系中使用thetaphi感到困惑.

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 = 60phi = 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆