I have two convex polygons, A and B. Given a specific side on each, I need to translate and rotate B so that the centerpoint of both lines coincide and the lines become parallel, giving the appearance of creating a new more complex polygon.
The translation is easy, but I can't figure out how to do the rotation. I thought just taking the angle between the vector between the center of A and the center of A's side, and the corresponding vector on B, and rotating B by the angle between them, but this doesn't work, and I'm out of ideas. Help?
For example: in this image, B's center is in the right place, but it needs to rotate 195 degrees so that its 0th side matches up to A's 0th side. I determined that answer through trial and error in this case; is there an analytic solution for any two polygons?
