Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding rotation between two congruent triangles

Tags:

c++

rotation

3d

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?

like image 444
chaosTechnician Avatar asked May 26 '11 01:05

chaosTechnician


1 Answers

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.

like image 179
Christian Rau Avatar answered Oct 15 '22 14:10

Christian Rau