Search for rotation between two congruent triangles

I am working on a 3D mesh parsing tool. I'm currently trying to determine the rotation between two congruent triangles in 3D space - we will call them ABC and DEF .

I can translate points A and D to the same place and now I need to define a rotation that places DEF on the same plane and in the same orientation as ABC , but I'm not familiar with math to do this. Can someone tell me how I can handle this?

I thought about using the cross product AB and DE to determine the axis of rotation, then the point product, to find the angle, and then derive a quaternion from them; but I don’t know if it will always align them correctly.

Am I mistaken about the above idea? Will triangles always align? If this is not the case, then what is the alternative way to find the turn?

+6
source share
2 answers

Your right when your first part turns AB onto DE (or vice versa). But this only aligns one edge. To align the other two, you still need to turn C by F (after the first rotation). The required angle and axis can be calculated simply by turning the two faces of the normals of the triangles at each other using your proposed approach (from your question, I suppose, you know how to calculate the face of the normal of a triangle).

EDIT: So, follow these steps:

  • Translate A to D
  • Turn AB onto DE
  • Rotate C to F by rotating the normal faces of the triangles to each other

You should accept the face normals of already partially transformed triangles (after step 2), but maybe they coincide with the original ones (not sure about this). Then you can simply combine these transformations into one.

+3
source
  • Translate ABC so that the normal surface ABC at point A coincides with point D in the base.
  • Rotate ABC so that the normal surface at point A matches the surface normal at D. This is the only tricky part. Fortunately, this is a very common thing. It is identical to rotating the direction of the 3D camera. Google found this link .
  • Now rotate the triangle ABC with A at the origin so that B and C coincide with D and E. This is the standard two-dimensional rotation matrix.
0
source

Source: https://habr.com/ru/post/889061/


All Articles