def get_bbox(self, points=None): """ Get bounding box of this object. Returns ------- (p1, p2, p3, p4): a 4-tuple of the points in data coordinates, beginning with the lower-left and proceeding counter-clockwise. """ if points is None: x1, y1, x2, y2 = self.get_llur() return ((x1, y1), (x1, y2), (x2, y2), (x2, y1)) else: return trcalc.strip_z(trcalc.get_bounds(points))
def get_llur(self): points = (self.crdmap.offset_pt((self.x, self.y), (-self.xradius, -self.yradius)), self.crdmap.offset_pt((self.x, self.y), (self.xradius, -self.yradius)), self.crdmap.offset_pt((self.x, self.y), (self.xradius, self.yradius)), self.crdmap.offset_pt((self.x, self.y), (-self.xradius, self.yradius))) mpts = np.asarray(self.get_data_points(points=points)) if hasattr(self, 'rot_deg'): xd, yd = self.crdmap.to_data((self.x, self.y)) mpts = trcalc.rotate_coord(mpts, [self.rot_deg], [xd, yd]) a, b = trcalc.get_bounds(mpts) return (a[0], a[1], b[0], b[1])
def get_llur(self): a, b = trcalc.get_bounds(self.get_data_points()) return (a[0], a[1], b[0], b[1])