This is all about mathematics. It’s a shame that I’v forgotten those I learned in scool.
OK, I’m trying to get the image dimension after rotation (using canvas) with a certain angle in Javascript.

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since I don’t have any tools other than MSPaint here, I’ll re-use your image:
Say your original rectangle’s size is R(ectangle)W(idth) * RH(eight),
in this case
RW=200,RH=80;After rotating a certain angle A, counterclockwise,
where
0deg <= A <= 90degin degrees (or0 <= A <= Math.PI/2in radians),in this case
A=30degorA=Math.PI/6,In the new “outer” rectangle, each side is divided by two parts (for the convenience of describing; corresponding to the image).
On the left side, let’s say the upper (purple) part is called N(ew)H(eight)U(p), and the lower (red) part is called NHL(ow);
Same rule on the bottom side, we have NW(idth)L(eft) (blue) and NWR(ight) (orange).
So the size (area) of new rectangle would be
(NHU + NHL) * (NWL + NWR)According to the definition of
sinandcos:(if you’re using
Ain degrees, replaceAtoMath.PI*A/180).So the new “outer” width would be
NWL + NWR, and new “outer” height would beNHU + NHL, and now you can calculate everything.