javascript - How can I calculate the size of an outer rectangle when it is rotated and must encompass an inner rectangle totally -


I have many answered questions, explaining how to calculate the bounding box of the curved rectangle But what i need to do is reverse

Red Rectangle A is described as:

  var box = {x: 0, y: 0, w: 100, h : 200};  

And the dimension of blue rectangle b is exactly , when it is rotated not .

Given that the rectangle B has been rotated around its center point and given in the angle of radians, I use the minimum size Rectangle <<> B may occur when rectangular A should always fit inside it while maintaining its original aspect ratio (as previously mentioned, rectangular A similar)

Enter image details here

If you label edges of rectangles and attract an extra line (green in the diagram), you can see what you need to calculate:

Enter image details here

then c = a * Cos (θ) + b * sin (Θ)

and d = b * c / a


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -