Similarity between two triangles

I have two two-dimensional triangles (i.e. both of them lie in the plane) and would like to find a similarity transformation (rotation + scale + translation) that most closely maps one of them to the other.

The two triangles are NOT alike, so I just want the transformation to bring them as close as possible.

I know that I can create an affine transformation between two triangles that will accurately display one on the other, but I do not want the shift effect to be present in the affine transforms. I want my conversion to consist only of translations, rotations, and scaling.

Any idea how to do this?

+4
source share
1 answer

Identifying similarities is not an easy task, but here are a few ideas you can play with. Suppose you want to convert triangle A (almost) to triangle B

  • Scale: scale triangle A by region (B) / region (A)
  • Transformation: Transform triangle A with a vector that allows you to match centroids as a triangle.
  • Rotation: Use the optimization method to select a value in the range [0, 360) for rotation that matches your personal similarity criteria.

Perhaps the hardest part of the rotation. A simple but effective idea would be to climb the hill , starting with three points and taking the best. Three points is the amount of rotation required to place one of the points A at each of the points B.

The similarity criterion itself is also not easy. One thing that comes to mind is the amount of overlapping surface after the transformation. Calculating this is not easy, or at least cumbersome.

+2
source

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


All Articles