将局部旋转添加到全局旋转
我尝试了很多公式和转换,但没有给我带来我期望的结果。
场景很简单:
3DS Max等3D软件如何将局部旋转增量“转化”为全局绝对旋转?
一个例子可以帮助你理解: 3DS Max - Maya - Modo(所有三个都给了我相同的结果,所以我倾向于相信这个结果是正确的。)假设绝对旋转顺序为 XYZ。
1. World Rotation Y = 35.0;
2. Local Rotation X = 35.0;
在这些转换之后,按照这个顺序,我查看世界绝对旋转,我看到的是 X:40.524 Y:-28.024 Z:-21.881
他们是如何实现这个结果的?什么样的公式?使用矩阵、欧拉角或四元数,无论如何,我怎样才能得到相同的结果?
谢谢。
PS:一个简单的解决方案是使用四元数或矩阵,将局部旋转添加到全局旋转中,然后检索绝对结果。但这效果不佳,因为这样我们无法控制旋转顺序,结果总是使用公式的顺序来检索值。
I've tried many formulas and conversions, but nothing gave me the result I expect.
The scenario is very simple:
How the 3DS Max and other 3D softwares make the "transformation" of an increment in local rotation to the global absolute rotation?
An example can help you to understand:
3DS Max - Maya - Modo (all three gave me the same result, so I'm inclined to believe that this result is correct.) Assuming Absolute rotation order as XYZ.
1. World Rotation Y = 35.0;
2. Local Rotation X = 35.0;
After these transformations, in that order, I look at the World Absolute rotation and what I see is X:40.524 Y:-28.024 Z:-21.881
How they achieve that result? What kind of formula? Using matrix, Euler angles or quaternions, whatever, how can I get the same result?
Thank you.
PS: A simple solution could be use of a quaternion or a matrix, add the local rotation into the global and then retrieve the absolute result. But this doesn't work well, because at this way we don't have control over the rotation order, the result always come using the order of the formula to retrieve the values.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要根据旋转应用的顺序乘旋转矩阵,如果要首先应用局部旋转(我怀疑是这样),那么:(
前提是您预先-乘以列向量来应用你的变换,如果你以相反的方式做,只需取整个表达式的转置)
类似地,如果你正在使用四元数,你应该乘你的四元数(不添加它们)。
You want to multiply the rotation matrices in order dependent on the order in which the rotations are applied, if the local rotation is to be applied first (which I suspect it is) then:
(provided you are pre-multiplying column vectors to apply your transformations, just take the transpose of the whole expression if you're doing it the other way round)
Similarly, if you are working with quaternions you should be multiplying your quaternions (not adding them).
旋转矩阵如下所示(假设列向量表示):
乘以“局部”意味着矩阵位于右侧。乘以“全局”意味着矩阵位于左侧。所以你的旋转是Ry(35°)*Rx(35°)。或者近似:
欧拉旋转顺序 XYZ 表示Rx(ax)*Ry(ay)*Rz(az)。因此,如果您插入数字Rx(40.524°)*Ry(-28.024°)*Rz(-21.881),您将得到大约(在舍入误差内)相同的矩阵(我做了尝试一下,只是为了确定一下)。
The rotation matrices look like this (assuming column vector representation):
Multiplying 'local' means that the matrix goes on the right. Multiplying 'global' means the matrix goes on the left. So your rotation is Ry(35°)*Rx(35°). Or approximately:
The Euler rotation order XYZ means Rx(ax)*Ry(ay)*Rz(az). So, if you plug in the numbers Rx(40.524°)*Ry(-28.024°)*Rz(-21.881), you get approximately (within round-off error) the same matrix (I did try it, just to make sure).