有效的方式来反映四元数旋转的效果呢? [英] Efficient way to mirror effect of quaternion rotation?

查看:238
本文介绍了有效的方式来反映四元数旋转的效果呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

四元数重新present旋转 - 它们不包含有关缩放或镜像信息。然而,它仍然是可能的,以镜像旋转的效果。

Quaternions represent rotations - they don't include information about scaling or mirroring. However it is still possible to mirror the effect of a rotation.

考虑在xy平面上的镜像(我们也可以把它沿z轴的镜像)。绕x轴的镜像在xy平面上的旋转将被否定。同样地与围绕y轴的旋转。然而,绕z轴的旋转将保持不变。

Consider a mirroring on the x-y-plane (we can also call it a mirroring along the z-axis). A rotation around the x-axis mirrored on the x-y-plane would be negated. Likewise with a rotation around the y axis. However, a rotation around the z-axis would be left unchanged.

又如:绕轴线90度旋转(1,1,1)反映在xy平面会给-90°左右旋转(1,1,-1)。为了帮助直觉,如果你能想象轴的描绘和一个圆形箭头指示旋转,然后镜像的可视化指明了新的转动应。

Another example: 90º rotation around axis (1,1,1) mirrored in the x-y plane would give -90º rotation around (1,1,-1). To aid the intuition, if you can visualize a depiction of the axis and a circular arrow indicating the rotation, then mirroring that visualization indicates what the new rotation should be.

我已经找到一种方法来计算这个镜像旋转,像这样的:

I have found a way to calculate this mirroring of the rotation, like this:

  • 获取四元数的角度轴重新presentation。
  • 对于每个轴x,y和z的。
    • 如果换算为负(镜像)沿轴:
      • 在否定双方的角度和轴。
      • Get the angle-axis representation of the quaternion.
      • For each of the axes x, y, and z.
        • If the scaling is negative (mirrored) along that axis:
          • Negate both angle and axis.

          这仅支持沿主坐标轴,X,Y和Z镜像,因为这是我所需要的。它的工作原理为,虽然任意旋转。

          This only supports mirroring along the primary axes, x, y, and z, since that's all I need. It works for arbitrary rotations though.

          不过,从四元数角度轴的转换和从角度轴回四元数是昂贵的。我不知道是否有一种方法来直接进行转换的四元数本身,而是我的COM $ P $四元数的数学phension不足以取得任何自己。

          However, the conversions from quaternion to angle-axis and back from angle-axis to quaternion are expensive. I'm wondering if there's a way to do the conversion directly on the quaternion itself, but my comprehension of quaternion math is not sufficient to get anywhere myself.

          (发布于计算器,而不是数学有关的论坛由于计算有效方法的重要性。)

          (Posted on StackOverflow rather than math-related forums due to the importance of a computationally efficient method.)

          推荐答案

          我做了一些进一步的分析,它会出现一个四元数的影响(W,X,Y,Z)可以有它反映这样的效果:

          I did some further analysis, and it appears the effect of a quaternion (w, x, y, z) can have it's effect mirrored like this:

          • 沿X轴旋转翻转四元数y和z元素的镜面效果。
          • 在沿Y轴旋转的镜面效果通过翻转四元数的X和Z元素。
          • 在沿Z轴的旋转的镜面效果翻转x和四元数ÿ元素。

          四元数的W元素永远需要被感动。

          The w element of the quaternion never needs to be touched.

          不幸的是我还是不明白,四元数足够好,能够解释为什么这个工作,但我得出它的实现转换,并从轴的角度格式,并实施该解决方案后,它的工作原理一样好我原来在它我已经执行了所有的测试。

          Unfortunately I still don't understand quaternions well enough to be able to explain why this works, but I derived it from implementations of converting to and from axis-angle format, and after implementing this solution, it works just as well as my original one in all tests of it I have performed.

          这篇关于有效的方式来反映四元数旋转的效果呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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