Originally Posted by

**GClements**
For an orthographic projection, you'd typically have minimum bounds for each direction. For a given window size, you compute separate scale factors (window size divided by bounds) for each direction, choose the smallest scale factor, and apply that to both directions. So if the minimum bounds were the same in each direction, if the window was taller than it was wide, the width would determine the scale factor and you'd get extra at the top and bottom. If the window was wider than tall, the height would determine the scale factor and you'd get extra at the left and right.

This doesn't work so well for a perspective projection, because wide angles result in significant distortion near the edges. So you need to ensure that the view angle in the larger direction doesn't exceed some threshold, even if that means that the view angle in the smaller direction is narrower than you would otherwise like.

Given that you presumably want the aspect ratio to be correct, you get to choose one other parameter. If you have multiple constraints, then you find the limiting value for each constraint separately, then choose a value which satisfies all of them.