def ellipse_extent(a, b, theta):
 t = np.arctan2(((- b) * np.tan(theta)), a)
 dx = (((a * np.cos(t)) * np.cos(theta)) - ((b * np.sin(t)) * np.sin(theta)))
 t = np.arctan2(b, (a * np.tan(theta)))
 dy = (((b * np.sin(t)) * np.cos(theta)) + ((a * np.cos(t)) * np.sin(theta)))
 return np.abs([dx, dy])

def ellipse_extent ( a , b , theta ) : t = np . arctan2 ( ( ( - b ) * np . tan ( theta ) ) , a ) dx = ( ( ( a * np . cos ( t ) ) * np . cos ( theta ) ) - ( ( b * np . sin ( t ) ) * np . sin ( theta ) ) ) t = np . arctan2 ( b , ( a * np . tan ( theta ) ) ) dy = ( ( ( b * np . sin ( t ) ) * np . cos ( theta ) ) + ( ( a * np . cos ( t ) ) * np . sin ( theta ) ) ) return np . abs ( [ dx , dy ] )
calculates the extent of a box encapsulating a rotated 2d ellipse .