This is part of larger script, where the goal is to generate multiple rotation alternatives for a series of polygons.
In this case, I have a 5-vertex closed polygon, where the midpoint of its "tip" is located in the center of the axes (0,0).
What I am trying to achieve is, after generating a series of rotations from an arbitrary point -located in the feature's upper segment (see blue point in pictures below)- to calculate the shift in coordinates the rotation caused, in order to move the whole polygon accordingly afterwards, so the "tip" midpoint of the rotated polygon is again place at the center of the axes.
Please see pictures below for better understanding :
In picture one, the original position of the polygon is shown, where the midpoint of the tip is located in the center of axes.
In the second picture, a clockwise rotation of 45 degrees has been applied, where the blue point has been used as an "anchor" (0,31).
In the third picture, the shift has been implemented, where the midpoint of the tip of the polygon has been replaced to the center of the axes.
After doing some research, the affiner transformer seems to be a good use, but not sure how to implement it - especially when the rotation has not happened from the center of the axes.
The complete feature consists of multiple polygons, but the rotation is being applied only to specific ones, like the ones in the picture. I believe that if the same shift is applied to the rest of the parts, like the one in picture nr.3 , they will also be moved accordingly.
Any help would be really appreciated!
Thank you very much!