调整相机坐标以表示方位角、仰角和滚动值的变化

发布于 2024-11-16 19:04:14 字数 430 浏览 2 评论 0原文

我目前正在使用 libQGLViewer,并且正在从传感器接收数据流,并保持方位角高程滚动值,3个欧拉角

该问题可以被视为代表一架飞机的摄像机,以及飞机移动时方位角、仰角和横滚的变化。

我需要一组通用的变换矩阵来变换相机点和向上向量来表示这一点,但我不确定如何计算它们,因为每次旋转后旋转的轴都会发生变化(我认为?)。

或者只是以某种方式将方位角、仰角、滚转值传递给相机并让一些函数为我做这件事?我知道 cameraPosition.setOrientation(Quaterion Something) 可能有效,但我无法真正理解它。有什么想法吗?

I'm currently working with libQGLViewer, and I'm receiving a stream of data from my sensor, holding azimuth, elevation and roll values, 3 euler angles.

The problem can be considered as the camera representing an aeroplane, and the changes in azimuth, elevation and roll the plane moving.

I need a general set of transformation matrices to transform the camera point and the up vector to represent this, but I'm unsure how to calculate them since the axis to rotate about changes after each rotation ( I think? ).

Either that, or just someway to pass the azimuth, elevation, roll values to the camera and have some function do it for me? I understand that cameraPosition.setOrientation(Quaterion something) might work, but I couldn't really understand it. Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眸中客 2024-11-23 19:04:14

例如,您可以仅采用三个矩阵绕坐标轴旋转,分别插入角度,然后将这三个矩阵相乘以获得最终的旋转矩阵(但使用正确的乘法顺序)。

您也可以仅根据欧拉角计算四元数。请参阅此处寻找想法。请记住,您始终必须使用欧拉角的正确顺序(无论您的三个值意味着什么),也许需要进行一些实验(那些不同的欧拉约定总是让我发疯)。

编辑:回应您的评论:这是按轮换顺序计算的。像 v' = XYZv 这样应用的矩阵对应于关于 z 的旋转,不变的 y,然后不变的 x,等于 x、y',然后等于 z''。因此,您必须留意轴(方位角之类的词的含义)以及围绕这些轴旋转的顺序。

For example you could just take the three matrices for rotation about the coordinate axes, plug in your angles respectively, and multiply these three matrices together to get the final roation matrix (but use the correct multiplication order).

You can also just compute a quaternion from the euler angles. Look here for ideas. Just keep in mind that you always have to use the correct order of the euler angles (whatever your three values mean), perhaps with some experimentation (those different euler conventions always make me crazy).

EDIT: In response to your comment: This is accounted by the order of rotations. The matrices applied like v' = XYZv correspond to roation about z, unchanged y and then unchanged x, which is equal to x, y' and then z''. So you have to keep an eye on the axes (what your words like azimuth mean) and the order in which you rotate about these axes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文