-
Calculate the size of an rotated rectangle to be exactly at the comp borders
Hi, this may be more of a math problem but im totally stuck, Ill try to explain:
I have a comp (1080 by 1080) containing a rectangle with a width of 100 and a height of 1080. So at zero degrees the rectangle fits perfectly in the comp. Now i want to rotate the rectangle and while this happens the height should adjust, so that the rectangle is always at the edge of the comp ( not completely inside, so that one corner always overlaps). The value must be precise here so i cant start with an arbitrary long rectangle with most of the rectangle being hidden by the edge of the canvas.
Through some trial and error I got that the height of the rectangle at 15 degrees should be around 1145 pixels, but I cant figure out why. Ive attached two screenshots to illustrate the problem (the red hatched area in the second pic is the original rectangle of 1080px height). Is there some way to calculate this using sin or cos? Because I couldnt get it to work 🙁