While working on a project for a friend, I shot some footage from the back of a pick up truck. I don’t know if you’ve ever spent 3 hours driving around a town strapped to the bed of a pickup truck trying to compose shots on a tripod while we drove by -but it’s a pretty difficult and motion sickness inducing task. Being that we drove up and down hills, the camera wasn’t always level. In reviewing the footage I discovered that I had to correct the angle of a lot of footage which led me to a basic question:

How far do you have zoom in to fill the screen after you apply rotation to fix an unintentional dutch angle?

In the past I have just eyeballed the effect. But often when I just eyeball it, I’ll later discover that I didn’t quite zoom in far enough and left little triangles of black at the top and bottom of the image. There has to a mathematical way to figure this out!

My first attempt to derive a formula over lunch left me with a disaster. My apologies to the staff at Carls Jr. for the mathematical obscenities I must have uttered. I gave up trying logic my way out of it and I decided to try to solve the problem with brute force. Back in the office and away from the prying eyes of fast food employees, I opened a spreadsheet and Premiere Pro and then proceeded to find the scale for each degree rotation from 1 to 90. Then I plotted my results and found a surprisingly smooth curve… so there had to be a formula. Some quick googling found me the solution. Plotting this new formula showed an identical curve… but a found solution is the height of dissatisfaction especially for a math nerd like me.

Back to the drawing board. The first clue I needed was the fact that the smaller triangle’s corners will always lie on a “X” created by connecting the opposing corners. With this this understanding you would just need to find where the rotated frame touches “X” and place the corners of your smaller box at that intersecting point.

So now I have a illustration I can work off of:

The objective is to find a formula for the length of that bold blue bar which is one half the width of the smaller rectangle (a1). Because we know angle of theta which is the amount of rotation we apply to the frame – we can use cosine and the length of m to determine (a1)/2. To determine the length m we have to use tangent of theta using the b/2 as the length of adjacent side to determine n and add it to the tangent of (t – theta) to determine p. And then it’s a matter of substitution and simplifying…

Well it’s been 20 years since I took any serious trigono… whoa…. gimme a second.. just feeling old… well in those years a bunch of trigonometric substitutions have since leaked out of the sides of my cerebral cortex and I had to reference a handy Trig cheat sheet. After pages and pages of bad attempts at trying to crack the equation I finally found my algebraic mistake (I got confused when dividing by a fraction). Without further ado, Here’s the algebraic simplification:

Using the inverse of the aspect ratio (b/a) you can derive the value for the height giving this complete formulation: Divide the original width of rectangle (a) by new value you get with this formula and you get the scale factor. I put the formula in a Google sheets calculator to make it easier to calculate. So let’s see if it works in a real world example and correct this dutch angle of Adam West’s Batman:

There’s a couple interesting thing to note about this equation: when rotated fully to 90 degrees, the zoom will be the same as the aspect ratio of whatever you’re working with. The maximum zoom will occur when the rotation is equal to (t) which I designated the angle of the diagonal of the frame.

So is this a practical method for figuring out how much zoom is needed to fix a shot that’s slightly off? Oh hell no. Just eyeball it. But if you’re writing some code that needs to do this, this function might be just what you need.But life isn’t always about what’s useful right at this moment – sometimes those little puzzles like this engross you so much you can’t put them down. Could it ever have practical use to me? Who knows? Who cares?

A life where every bit of knowledge and discovery is limited only to what I can use right now is a pretty poor life if you ask me.

1. 1. 