Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:48:52+00:00 2026-06-15T08:48:52+00:00

This is all about mathematics. It’s a shame that I’v forgotten those I learned

  • 0

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.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:48:53+00:00Added an answer on June 15, 2026 at 8:48 am

    Since I don’t have any tools other than MSPaint here, I’ll re-use your image:

    enter image description here

    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 <= 90deg in degrees (or 0 <= A <= Math.PI/2 in radians),

    in this case A=30deg or A=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 sin and cos:

    NWL = RW * Math.cos(A); //where A is in radians
    NHL = RW * Math.sin(A);
    
    NHU = RH * Math.cos(A);
    NWR = RH * Math.sin(A);
    

    (if you’re using A in degrees, replace A to Math.PI*A/180).

    So the new “outer” width would be NWL + NWR, and new “outer” height would be NHU + NHL, and now you can calculate everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before you all get pissy about me posting this question again, let me explain
I keep hearing about DLL hell - what is this all about?
I have a feeling I'm going about this all wrong. But anyway. I have
In my iPad App, I am using AQGridView. This app is all about matching
first of all this is my third question about web services here and i
I have read all threads about this without finding any answer to my problem.
Well, first of all sorry about this question it must be pretty straight forward
I've a question about weka as this person: Hi all: I felt really strange
The compiler complains about this, after I activated all kind of warnings: For MyApp_Prefix.pch
(This is a question about a vague problem. I try to present all relevant

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.