Finding rotation between two congruent triangles

2019-06-19 10:46发布

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?

标签: c++ 3d rotation
2条回答
干净又极端
2楼-- · 2019-06-19 11:10
  1. Translate ABC so that the surface normal of ABC at A coincides with point D at the base.
  2. Rotate ABC so that the surface normal at A coincides with the surface normal at D. 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.
  3. Now rotate triangle ABC with A at the origin so that so B and C coincide with D and E. This is a standard 2D rotation matrix.
查看更多
混吃等死
3楼-- · 2019-06-19 11:35

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:

  1. Translate A onto D
  2. Rotate AB onto DE
  3. Rotate C onto F by rotating the face normals of the triangles onto each other

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.

查看更多
登录 后发表回答