We are working on a composer atlas of hundreds of maps showing highway routes, all of which are north-oriented. We would like to be able to rotate these maps to the ideal rotation that maximizes the scale that the route can be displayed. I believe the best way to calculate this would be by looking at the dimensions of the minimum bounding box of the route, compared to the dimensions of the map frame.
For example, suppose that I have a route whose MBB is 300m in the X dimension and 100m in the Y dimension (3:1 ratio). In comparison, the ratio of the map frame is 2:3 (taller than wider). Is there a way to calculate the angle that the map needs to be rotated away from north so that the MBB of the route at this rotation becomes 2:3, which should maximize the scale that it can be displayed?