# Thread: Rotation of a square on a plane

1. ## Rotation of a square on a plane

Hi All,

I hope you can help (and I hope this is the right forum for this subject)

I have a resizeable plane (say 300 x 300 in size)
On this plane I have a square (say 290 x 290 in size)

When i rotate this square on this plane by say 25 degrees around the squares center parts of the square are no longer visible on the existing plane.

My goal is to have the plane resize based on the new square but all I have available is the original dimensions of the plane, the original dimensions of the square and the angle it's being rotated by in my problem i do have access to various trigonometric functions such as cos and sin, I also know the center of the original square.

basically i'm looking for an equation which would take the angle and dimensions of the original square and plane and produce the new correct dimensions for the plane so that it engulfs the new square

Please anyone that could help I am desperate for help

kind regards
James

2. Hello, hellzone!

I have a resizeable plane (say, 300 x 300 in size).
On this plane I have a square (say, 290 x 290 in size).

When i rotate this square on this plane by. say $25^o$ about the square's center.
parts of the square are no longer visible on the existing plane.

My goal is to have the plane resize based on the new square
but all I have available is the original dimensions of the plane,
the original dimensions of the square and the angle it's being rotated by.

Basically i'm looking for an equation which would take the angle and dimensions
of the original square and plane and produce the new correct dimensions
for the plane so that it engulfs the new square

Assuming that the square must be 290 units on a side,
. . the worst case scenario occurs when it is rotated $45^o.$

Code:
              *
*   *
290  *       *  290
*           *
*               *
* - - - - - - - - - *
*        x      *
*           *
*       *
*   *
*

In the right triangle, we have: . $x^2 \:=\:290^2 + 290^2$

Then: . $x^2 \:=\:2\cdot290^2 \quad\Rightarrow\quad x \:=\:290\sqrt{2} \:=\:410.1219331$

Rounding up, we have 411.

Therefore, the plane must be at least $411 \times 411.$

In general, for a square of side $\,a$,

. . the plane must be at least $\left\lceil a\sqrt{2}\,\right\rceil \times \left\lceil a\sqrt{2}\,\right\rceil$

. . where $\lceil x\rceil$ is the "round up" function.

3. Let's say the small square is of size D_sq x D_sq. Your goal is to find the maximum extent of any of the corners as measured in the (x,y) plane as you rotate the square through an angle Θ. Actually due to symmetry you only need to consider one corner, such as the upper right,, and find the max distance of this point in either the x or y direction from the origin. Then double this ditance to find the length of the side of the plane that the square must sit on.

Consider the dimension from the center of the square to the corner - that would be D_sq/sqrt(2). The (x,y) coordinate of the upper right corner of the square when it is rotated by Θ from its original aligned position is, based on the center of the square being at (0,0) is :

X = D_sq/sqrt(2) cos(Θ+π/4), Y = D/sqrt(2)sin(Θ+π/4)

To find the size of the square you need to compare the absolute values of these coordinates to find the distance left or right, up or down from the origin. These max dimensions can be rearranged using trig identities to yield

X_max = D/2 x max(|cosΘ-sinΘ|, |cosΘ+sinΘ|)
Y_max = D/2 x max(|sinΘ+cosΘ|, |[sinΘ-cosΘ|)

Finally, note that the values for X_max and Y_max are the same - hence the dimension of your plane is two times either X_max or Y_max:

D_plane = D_sq x max(|cosΘ-sinΘ|, |cosΘ+sinΘ|)

This function has a minimum of value of D_sq (whenΘ = 0), and a maximum value of sqrt(2) times D_sq (when Θ = π/4)