def bbox(self):
<EOL>from math import atan, tan<EOL>if cos(self.phi) == <NUM_LIT:0>:<EOL><INDENT>atan_x = pi/<NUM_LIT:2><EOL>atan_y = <NUM_LIT:0><EOL><DEDENT>elif sin(self.phi) == <NUM_LIT:0>:<EOL><INDENT>atan_x = <NUM_LIT:0><EOL>atan_y = pi/<NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>rx, ry = self.radius.real, self.radius.imag<EOL>atan_x = atan(-(ry/rx)*tan(self.phi))<EOL>atan_y = atan((ry/rx)/tan(self.phi))<EOL><DEDENT>def angle_inv(ang, k):  <EOL><INDENT>return ((ang + pi*k)*(<NUM_LIT>/(<NUM_LIT:2>*pi)) - self.theta)/self.delta<EOL><DEDENT>xtrema = [self.start.real, self.end.real]<EOL>ytrema = [self.start.imag, self.end.imag]<EOL>for k in range(-<NUM_LIT:4>, <NUM_LIT:5>):<EOL><INDENT>tx = angle_inv(atan_x, k)<EOL>ty = angle_inv(atan_y, k)<EOL>if <NUM_LIT:0> <= tx <= <NUM_LIT:1>:<EOL><INDENT>xtrema.append(self.point(tx).real)<EOL><DEDENT>if <NUM_LIT:0> <= ty <= <NUM_LIT:1>:<EOL><INDENT>ytrema.append(self.point(ty).imag)<EOL><DEDENT><DEDENT>xmin = max(xtrema)<EOL>return min(xtrema), max(xtrema), min(ytrema), max(ytrema)<EOL>
returns a bounding box for the segment in the form
        (xmin, xmax, ymin, ymax).