方向向量转欧拉角,如何将方向向量转换为欧拉角?

I'm looking for a way to convert direction vector (X,Y,Z) into Euler angles (heading, pitch, bank). I know that direction vector by itself is not enough to get the bank angle, so there's also another so-called Up vector.

Having direction vector (X,Y,Z) and up vector (X,Y,Z) how do I convert that into Euler angles?

解决方案

Let's see if I understand correctly. This is about the orientation of a rigid body in three dimensional space, like an air plane during flight. The nose of that airplane points towards the direction vector

D=(XD,YD,ZD) .

Towards the roof is the up vector

U=(XU,YU,ZU) .

Then heading H would be the direction vector D projected onto the earth surface:

H=(XD,YD,0) ,

with an associated angle

angle_H=atan2(YD,XD) .

Pitch P would be the up/down angle of the nose with respect to the horizon, if the direction vector D is normalized you get it from

ZD=sin(angle_P)

resulting in

angle_P=asin(ZD) .

Finally, for the bank angle we consider the direction of the wings, assuming the wings are perpendicular to the body. If the plane flies straight towards D, the wings point perpendicular to D and parallel to the earth surface:

W0 = ( -YD, XD, 0 )

This would be a bank angle of 0. The expected Up Vector would be perpendicular to W0 and perpendicular to D

U0 = W0 × D

with × denoting the cross product. U equals U0 if the bank angle is zero, otherwise the angle between U and U0 is the bank angle angle_B, which can be calculated from

cos(angle_B) = Dot(U0,U) / abs(U0) / abs(U)

sin(angle_B) = Dot(W0,U) / abs(W0) / abs(U) .

From that you get the bank angle as

angle_B = atan2( Dot(W0,U) / Dot(U0,U) / abs(W0) * abs(U0) ) .

The normalization factors cancel each other if U and D are normalized.

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值