如何获得照相机从滚动,俯仰和偏航矢量? [英] How to get camera up vector from roll, pitch, and yaw?
问题描述
我需要从一个滚动,俯仰和偏航角度得到了载体一个摄像头(以获得正确的期待)(度)。我一直在尝试不同的事情了几个小时,没有运气:(。任何帮助这里将是AP preciated!
I need to get an up vector for a camera (to get the right look) from a roll, pitch, and yaw angles (in degrees). I've been trying different things for a couple hours and have had no luck :(. Any help here would be appreciated!
推荐答案
滚动,俯仰和偏航定义3轴的旋转。从这些角度可以构造一个3x3变换矩阵EX preSS这种旋转(这里看看)
之后,你有这个矩阵你把你的定期向上向量,说(0,1,0),如果上为Y轴,并与矩阵相乘。您将获得的是转化了载体。
Roll, Pitch and Yaw define a rotation in 3 axis. from these angles you can construct a 3x3 transformation matrix which express this rotation (see here how)
After you have this matrix you take your regular up vector, say (0,1,0) if 'up' is the Y axis and multiply it with the matrix. What you'll get is the transformed up vector.
修改 -
应用转换到(0,1,0)是同样的事情,走的是中间一排。 3矩阵的行组成的旋转系统的正交基。你要知道,一个3D图形API使用4X4矩阵。因此,为了使一个4x4矩阵出了3×3的旋转矩阵,你需要添加一个'1'M [3] [3](角落)和零点在剩下的像这样:
Edit-
Applying the transformation to (0,1,0) is the same thing as taking the middle row. The 3 rows of the matrix make up an orthogonal base of the rotated system. Mind you that a 3D graphic API uses 4x4 matrices. So to make a 4x4 matrix out of the 3x3 rotation matrix you need to add a '1' at M[3][3] (the corner) and zeros at the rest like so:
r r r 0
r r r 0
r r r 0
0 0 0 1
这篇关于如何获得照相机从滚动,俯仰和偏航矢量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!