通过坐标2个物体在两个位置的点来计算四元数 [英] calculate quaternion by coordinate 2 points of object in two positions

查看:38
本文介绍了通过坐标2个物体在两个位置的点来计算四元数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对象在 3D 中旋转.我有旋转中心和 2 点坐标在旋转而不是旋转位置.计算将对象从第一个位置旋转到两个位置的四元数.

Object rotate in 3D. I have rotation center and coordinate of 2 point in rotate and not rotate position. Calculate quaternion that rotate object from first position to two position.

推荐答案

我们必须在对象的第一个位置矢量化 OA' 和 OB'
OA 和 OB 位居第二
Q 向量部分四元数 Q0 标量部分

We have to vector OA' and OB' in first position of object
OA and OB in second position
Q vector part quaternion Q0 scalar part

图 1
评论
OAOB - 点向量积
OAxOB - 交叉向量积

从第一个位置到第二个位置的旋转对象的四元数是:
1 个案例
如果 OA
OB'-OBOA' 不等于零,则Q=Q0[(OA-OA')x(OB-OB')]/[OA*OB'-OA'OB],
其中 Q0-2=([(OA-OA')x(OB-OB')]/[OA
OB'-OA'OB])2+1

如果 OAOB'-OBOA'=0,则
2 个案例
如果 [OA'+OA]x[OB'+OB] 不等于零且 OB-OB' 不等于零,
那么存在 m OA-OA'=m
(OB-OB').搜索它.
Q=n*(mOB'+OA'),
其中 n=Q0
(OB-OB')2/(2*OB*[OA'xOB'])
Q0-2=(OB-OB')4*(OB'+OA')2/(2*OB*[OA'xOB'])2+1

如果 OAOB'-OBOA'=0 且 [OA+OA']x[OB+OB']=0
3 例
如果OB+OB'不等于0,则
Q=(OB+OB')/|OB+OB'|, Q0=0其他

4 例
OB+OB'=0
Q=([OB']x[OA'])/|[OB']x[OA']|, Q0=0

从四元数我们可以计算旋转矩阵或欧拉角

fig.1
COMMENT
OAOB - dot vector product
OAxOB - cross vector product

Quaternion of rotation object from first positon to second was:
1 case
If OA
OB'-OBOA' not equal zero, then Q=Q0[(OA-OA')x(OB-OB')]/[OA*OB'-OA'OB],
where Q0-2=([(OA-OA')x(OB-OB')]/[OA
OB'-OA'OB])2+1

If OAOB'-OBOA'=0, then
2 case
if [OA'+OA]x[OB'+OB] not equal zero and OB-OB' not equal zero,
then exist m that OA-OA'=m
(OB-OB'). Search it.
Q=n*(mOB'+OA'),
where n=Q0
(OB-OB')2/(2*OB*[OA'xOB'])
Q0-2=(OB-OB')4*(OB'+OA')2/(2*OB*[OA'xOB'])2+1

If OAOB'-OBOA'=0 and [OA+OA']x[OB+OB']=0
3 case
If OB+OB'not equal zero, then
Q=(OB+OB')/|OB+OB'|, Q0=0 else

4 case
OB+OB'=0
Q=([OB']x[OA'])/|[OB']x[OA']|, Q0=0

From quaternion we can calculate rotation matrix or Euler angles

这篇关于通过坐标2个物体在两个位置的点来计算四元数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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