import math
def rotate_point_about_origin(x,y,angle):
current_angle = math.atan2(y,x)
magnitude = math.hypot(x,y)
new_angle = current_angle + angle
new_x = magnitude*math.cos(new_angle)
new_y = magnitude*math.sin(new_angle)
return new_x, new_y
def get_dimensions_of_rotated_rectangle(width, height, angle):
corners = [
(+width/2.0, +height/2.0),
(+width/2.0, -height/2.0),
(-width/2.0, +height/2.0),
(-width/2.0, -height/2.0)
]
new_corners = [rotate_point_about_origin(*p) for p in corners]