I'm looking for an algorithm to calculate the translation, rotation and scaling required to position a convex polygon (P1) inside another convex polygon (P2). I need it to return the "best fit", meaning P1 is completely contained within P2 and has the maximum area possible.
Consider the following diagram: https://i.stack.imgur.com/PfnSG.png
The black polygon on the right (P1) needs to be placed optimally inside the blue polygon on the left (P2).
I have found lots of written papers online about polygon containment algorithms but those algorithms are to determine whether or not polygons can fit inside another polygon given the ability to translate and rotate them.
The algorithm that I'm looking for should always produce a result because it includes the ability to scale the polygon P1. I understand that this type of algorithm could produce multiple optimal answers and that's okay.
Any help?