def get_bb(self): """ Function that gets the bounding box of the Building :return: bounding box, list of float [width_from, height_from, width_to, height_to] """ _bb = list(get_min_max(self.building, 0)) + \ list(get_min_max(self.building, 1)) return _bb
def make(self): self._correct_volumes() x_min, x_max = get_min_max(self.volumes[0].mesh, 0) # width y_min, y_max = get_min_max(self.volumes[0].mesh, 1) # length if random.random() < 0.5: self.volumes[1].mesh.location[0] = random.choice( np.linspace(int(x_min + (self.volumes[1].length)), int(x_max - (self.volumes[1].length)), 10)) self.volumes[1].mesh.location[1] = y_min - self.volumes[1].width else: self.volumes[1].mesh.location[1] = random.choice( np.linspace(int(y_min + (self.volumes[1].width)), int(y_max - (self.volumes[1].width)), 10)) self.volumes[1].mesh.location[0] = x_min - self.volumes[1].length return self.volumes
def get_bb(self): """ Function that gets the bounding box of the Building :return: bounding box, list of float [width_from, height_from, width_to, height_to] """ x_min, y_min, x_max, y_max = list(get_min_max(self.volumes[0].mesh, 0)) + \ list(get_min_max(self.volumes[0].mesh, 1)) for v in self.volumes[1:]: _bb = list(get_min_max(v.mesh, 0)) + \ list(get_min_max(v.mesh, 1)) x_min, y_min = min(_bb[0], x_min), min(_bb[1], y_min) x_max, y_max = max(_bb[2], x_max), max(_bb[3], y_max) return [ round(x_min, 3), round(y_min, 3), round(x_max, 3), round(y_max, 3) ]