Alex Rivera | Logout

How to get size of a rotated rectangle

Asked 2010-07-12T18:36:54.000
13

Possible Duplicate:
Calculate Bounding box coordinates from a rotated rectangle, Picture inside.

I have a rotated rectangle, So how do i calculate the size of axis-aligned bounding box for the rotated rectangle in 2D Coordinates?

Attach Image http://img88.imageshack.us/img88/503/rotp.png

i know x, y, o (angle) but how do i get a, b

Thank you

Edit
Report

2 Answers

53
a = abs(x * sin(o)) + abs(y * cos(o))
b = abs(x * cos(o)) + abs(y * sin(o))
answered 2010-07-12T19:10:00.187
-5

It's a bit complicated, but for a rectangle, Area = b * h = length * width.

answered 2010-07-12T18:41:45.650

Your Answer