- Transform the coordinates of all four corners
- Find the smallest of all four x's as
min_x
- Find the largest of all four x's and call it
max_x
- Ditto with the y's
- Your bounding box is
(min_x,min_y), (min_x,max_y), (max_x,max_y), (max_x,min_y)
AFAIK, there isn't any royal road that will get you there much faster.
If you are wondering how to transform the coordinates, try:
x2 = x0+(x-x0)*cos(theta)+(y-y0)*sin(theta)
y2 = y0-(x-x0)*sin(theta)+(y-y0)*cos(theta)
where (x0,y0) is the center around which you are rotating. You may need to tinker with this depending on your trig functions (do they expect degrees or radians) the sense / sign of your coordinate system vs. how you are specifying angles, etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…