寻找两个全等三角形之间的旋转
我正在开发 3D 网格解析工具。目前,我正在尝试确定 3D 空间中两个全等三角形之间的旋转 - 我们将它们称为 ABC
和 DEF
。
我能够将点 A
和 D
平移到同一位置,现在需要确定将 DEF
放置在同一平面上的旋转与 ABC 方向相同,但我对数学不够熟悉,无法做到这一点。谁能告诉我如何解决这个问题?
我一直在考虑使用 AB
和 DE
的叉积来确定旋转轴,然后使用点积来找到角度,然后用它们制作一个四元数;但我不知道这是否总是能让它们正确对齐。
我上面的想法是不是有误?它总是对齐三角形吗?如果不能,有什么替代方法可以找到轮换?
I'm working on a 3D mesh parsing tool. Currently, I'm trying to determine the rotation between two congruent triangles in 3D space—we'll call them ABC
and DEF
.
I'm able to translate points A
and D
to the same location and now need to determine a rotation that would place DEF
on the same plane and in the same orientation as ABC
but I'm not familiar enough with the math to do it. Can anyone tell me how I can tackle this?
I've been thinking of using the cross product of AB
and DE
to determine a rotation axis, then the dot product to find an angle, then making a quaternion out of them; but I don't know if that will always properly align them.
Am I mistaken about the above idea? Will it always align the triangles? If it won't, what is an alternative way to find a rotation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的第一部分将AB旋转到DE(或其他方式)。但这只能对齐一条边。要对齐其他两个,您仍然需要将 C 旋转到 F 上(第一次旋转后)。可以通过使用您提出的方法将三角形的两个面法线相互旋转来计算必要的角度和轴(从您的问题我想您知道如何计算三角形的面法线)。
编辑:因此按顺序执行以下步骤:
您必须采用已经部分的面法线变换后的三角形(第 2 步之后),但它们可能与原始三角形相同(对此不确定)。然后,您可以将这些转换连接成一个。
Your right with your first part rotating AB onto DE (or the other way). But this only aligns one edge. To align the other two, you still need to rotate C onto F (after your first rotation). The neccessary angle and axis can be computed by just rotating the two face normals of the triangles onto each other using your proposed approach (from your question I suppose you know how to compute the face normal of a triangle).
EDIT: So take these steps in order:
You have to take the face normals of the already partly transformed triangles (after step 2), but it could be that they are the same as the original ones (not sure about that). You can then just concatenate those transformations into one.
这是唯一棘手的部分。幸运的是,这是很常见的事情。这与旋转 3D 相机方向相同。 Google 找到了此参考。
This is the only tricky part. Fortunately, this is a very common thing to do. It's identical to rotating the 3D camera direction. Google found this reference.