# [Math] Find the Bounding Rectangle of Rotated Rectangle

coordinate systemsgeometryrotations

I have rectangle with co-ordinates(x1,y1) and (x2,y2) and I have to rotate the rectangle an amount of θ about it centre using Rotation Matrix

 |  cosθ  sinθ |
| -sinθ  cosθ |


I need to find the co-ordinates of bounding rectangle after rotation.

Before rotation

0,0
|"""""""""""""""""""""""""""""""""""""""""""|
|                                           |
|  x1,y1                                    |
|       |"""""""""""""|                     |
|       |             |                     |
|       |             |                     |
|       |             |                     |
|       """""""""""""" x2,y2                |
|                                           |
|                                           |
""""""""""""""""""""""""""""""""""""""""""" W,H


After rotation

 0,0
|"""""""""""""""""""""""""""""""""""""""""""|
|           ?,?                             |
|            |""""/\"""""|                  |
|            |   /   \   |                  |
|            |  /      \ |                  |
|            | /        /|                  |
|            |/        / |                  |
|            |\       /  |                  |
|            |  \    /   |                  |
|            |    \ /    |                  |
|             """""""""""  ?,?              |
|                                           |
|                                           |
""""""""""""""""""""""""""""""""""""""""""" W,H


Is there any general equation for finding the co-ordinates of bounding rectangle?.

Thanks….

Haris.

For each of the four original corners: $$(x_1,y_1), (x_1,y_2), (x_2,y_1), (x_2,y_2)$$ use the rotation matrix to obtain four new corners. Then to obtain the two ordered pairs that define your bounding rectangle, let one ordered pair have the minimum $x$ and $y$ values out of all the new corners and let the other ordered pair have the maximum $x$ and $y$ values.