I have two 2D triangles (ie. they both lie in the plane), and would like to find the similarity transform (rotation + scale + translation) that maps one of them most closely onto the other one.
The two triangles are NOT actually similar so I just want the transformation to align them as best as possible.
I know I can create an affine transform between the two triangles which will map one exactly onto the other, but I don't want the shearing effect which is present in affine transforms. I want my transform to be composed only of translations, rotations, and scaling.
Any idea how to do this?
Defining similarity is not an easy task, but here are a few ideas you can play with. Say you want to transform triangle A (almost) to triangle B
[0, 360)
for rotation that meets your personal similarity criteria.The rotation part is probably the most difficult. A simple yet effective idea would be to apply hill climbing starting from three points and taking the best. The three points are the amount of rotation needed to put one of the points of A on each of the points of B.
The similarity criterion itself is also not easy. One thing that comes to mind is the amount of overlapping surface after the transformation. Computing this is not easy or at least is cumbersome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With