0
$\begingroup$

I'm developing a website. For design I need to calculate the angle of a rectangle which is needed to get the top left corner in a vertical line with the bottom right one.

Example: I've a square/rectangle with the dimensions 10×10 cm (or inch/pixels, doesn't matter). To get the top left corner in the same vertical line as the bottom right corner, you need to rotate it 45 degrees.

How do I calculate that angle? When i've the dimensions 312×64 (Height × Width) cm for instance.

I've tried with Angle = Width × (90 / (Width + Height)). But the result was incorrect.

I'm absolutely not a mathematician, so i'm sorry if this question is almost to simple to answer. Here an image describing the problem.

$\endgroup$
  • $\begingroup$ what is the center of rotation (i.e. point that does not move)? $\endgroup$ – Vasya Sep 20 '17 at 19:07
0
$\begingroup$

Rotate clockwise the rectangle around the intersection point of the diagonals of an angle $$\alpha=\arctan\left(\frac{64}{312}\right)$$

Hope it helps

enter image description here

$\endgroup$
0
$\begingroup$

It would be a bit easier if you had labeled the vertices. In your right-most figure, let A be the bottom vertex, and label the rest B, C, D counterclockwise. If we want to know what angle we need to rotate the rectangle into this situation, that's going to be the same as the angle to rotate it from the current orientation to a "standard" orientation. However, there are two different orientation; we can have the 11cm side horizontal or vertical. These give two different angle, which will add up to 90 (in the case of a square, the angles are the same and thus 45). Note that if we rotate the rectangle counterclockwise about point A until AB is vertical, then AB will, after the rotation, coincide with where the red line before the rotation. That means that the angle required is equal to the angle between AB and the red line, which is angle CAB. If we take the tangent of that angle, we get 11/32. So the angle will be arctangent(11/32). If we switch the two sides and get arctangent(32/11), we get the other angle that corresponds to AB being horizontal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.