def __init__(self, *args, **kwds): theta = kwds.pop('theta', 0.0) self.theta = 0.0 xmin, xmax, ymin, ymax = aabb_bbox(*args, **kwds) vertices = [(xmax, ymin), (xmax, ymax), (xmin, ymax), (xmin, ymin)] super(self.__class__, self).__init__(vertices) if theta: self.rotate(theta)
def test_aabb_func(): assert aabb_bbox(1, 2, 3, 4) == (1, 2, 3, 4) assert aabb_bbox(shape=(10, 20)) == (-5, 5, -10, 10) assert aabb_bbox(bbox=(1, 2, 3, 4)) == (1, 2, 3, 4)