I need to be able to calculate the size of rectangle 2
To illustrate my problem here is a diagram:

- I know the
widthandheightof rectangle 1 - I know the aspect ratio of
rectangle 2along with a minimumheightandwidthwhich will always be larger than rectangle 1 - I know the origin of the
rotationwhich is always the centre of rectangle 1 - I know the angle of
rotationin radians - rectangle 1 must always be fully inside rectangle 2
Given the above variables I need to calculate the smallest size rectangle 2 can be, while maintaining its aspect ratio and rotation origin.
This excellent function calculates the largest possible rectangle within a rotated outer rectangle.
Calculate largest rectangle in a rotated rectangle
I have tried to use it as a base to achieve the behaviour i require but so far with no luck. I'm linking to it in case it is helpful to anyone with greater Math knowledge than I.
Any help would be greatly appreciated.