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?