Returns the bounding box for this cell.

        Returns
        -------
        out : Numpy array[2,2] or ``None``
            Bounding box of this cell [[x_min, y_min], [x_max, y_max]],
            or ``None`` if the cell is empty.
18286
def get_bounding_box(self):
        
        if len(self.elements) == 0:
            return None
        if not (self._bb_valid and
                all(ref._bb_valid for ref in self.get_dependencies(True))):
            bb = numpy.array(((1e300, 1e300), (-1e300, -1e300)))
            all_polygons = []
            for element in self.elements:
                if isinstance(element, PolygonSet):
                    all_polygons.extend(element.polygons)
                elif isinstance(element, CellReference) or isinstance(
                        element, CellArray):
                    element_bb = element.get_bounding_box()
                    if element_bb is not None:
                        bb[0, 0] = min(bb[0, 0], element_bb[0, 0])
                        bb[0, 1] = min(bb[0, 1], element_bb[0, 1])
                        bb[1, 0] = max(bb[1, 0], element_bb[1, 0])
                        bb[1, 1] = max(bb[1, 1], element_bb[1, 1])
            if len(all_polygons) > 0:
                all_points = numpy.concatenate(all_polygons).transpose()
                bb[0, 0] = min(bb[0, 0], all_points[0].min())
                bb[0, 1] = min(bb[0, 1], all_points[1].min())
                bb[1, 0] = max(bb[1, 0], all_points[0].max())
                bb[1, 1] = max(bb[1, 1], all_points[1].max())
            self._bb_valid = True
            _bounding_boxes[self] = bb
        return _bounding_boxes[self]
837934
def get_closest_box(self, pos):
        """"""
        pos = np.atleast_2d(pos)
        d = np.sum((np.array(self.box_pos) - pos) ** 2, axis=1)
        idx = np.argmin(d)
        return idx
1112661
def _mark_grid_bounds(self, plane, region_bbox):
        
        # Grid boundaries
        vbars = np.zeros([self.num_rows, self.num_cols + 1], dtype=np.bool)
        hbars = np.zeros([self.num_rows + 1, self.num_cols], dtype=np.bool)

        def closest_idx(arr, elem):
            left = bisect.bisect_left(arr, elem) - 1
            right = bisect.bisect_right(arr, elem) - 1
            return left if abs(arr[left] - elem) < abs(arr[right] - elem) else right

        # Figure out which separating segments are missing, i.e. merge cells
        for row, (y0, y1) in enumerate(self.yranges):
            yc = (y0 + y1) // 2
            for l in plane.find((region_bbox.x0, yc, region_bbox.x1, yc)):
                vbars[row, closest_idx(self.xs, l.xc)] = True
        for col, (x0, x1) in enumerate(self.xranges):
            xc = (x0 + x1) // 2
            for l in plane.find((xc, region_bbox.y0, xc, region_bbox.y1)):
                hbars[closest_idx(self.ys, l.yc), col] = True
        return vbars, hbars
945100
def get_cell_boundary_map(ds):
    '''
    
    '''
    boundary_map = {}
    for variable in ds.get_variables_by_attributes(bounds=lambda x: x is not None):
        if variable.bounds in ds.variables:
            boundary_map[variable.name] = variable.bounds
    return boundary_map
330862
def get_area(self):
        
        mesh = self.mesh
        _, _, _, area = mesh.get_cell_dimensions()

        return numpy.sum(area)
963014
function(box_or_min, max){
			var min;
			if( is.AABB( box_or_min ) ){
				max = box_or_min.getMax();
				min = box_or_min.getMin();
			} else {
				min = box_or_min;
			}
			this.x = mathUtils.clip(this.x, min.x, max.x);
			this.y = mathUtils.clip(this.y, min.y, max.y);
			this.z = mathUtils.clip(this.z, min.z, max.z);
			return this;
		}
596440
def box(self):
        
        b = self.GetBounds()
        from vtkplotter.shapes import Box
        pos = (b[0]+b[1])/2, (b[3]+b[2])/2, (b[5]+b[4])/2
        length, width, height = b[1]-b[0], b[3]-b[2], b[5]-b[4]
        oa = Box(pos, length, width, height, c='gray').wire()
        if isinstance(self.GetProperty(), vtk.vtkProperty):
            oa.SetProperty(self.GetProperty())
        return oa
176307
def bounds(self):
        
        bounds = []
        for p in self.params:
            if p.fixed:
                if p.value >= 0.0:
                    bounds.append([np.nextafter(p.value, 0), p.value])
                else:
                    bounds.append([p.value, np.nextafter(p.value, 0)])
            else:
                bounds.append([p.min, p.max])
        return bounds
144727
def _get_bounds(self, ib, dimension):
        
        sign_ = 2 * ib - 1
        assert sign_**2 == 1
        if self.bounds is None or self.bounds[ib] is None:
            return array(dimension * [sign_ * np.Inf])
        res = []
        for i in xrange(dimension):
            res.append(self.bounds[ib][min([i, len(self.bounds[ib]) - 1])])
            if res[-1] is None:
                res[-1] = sign_ * np.Inf
        return array(res)
81278
function getBoundingBox() {
    if (!bounds) return // client does not want to restrict movement

    if (typeof bounds === 'boolean') {
      // for boolean type we use parent container bounds
      var ownerRect = owner.getBoundingClientRect()
      var sceneWidth = ownerRect.width
      var sceneHeight = ownerRect.height

      return {
        left: sceneWidth * boundsPadding,
        top: sceneHeight * boundsPadding,
        right: sceneWidth * (1 - boundsPadding),
        bottom: sceneHeight * (1 - boundsPadding),
      }
    }

    return bounds
  }
732573
def get_outer_bounding_boxes(rectangles):
    
    if len(rectangles) == 0:
        return []
    outer_bboxes = [rectangles[0]]
    for bbox2 in rectangles[1:]:
        overlap_indexes = []
        for i, bbox1 in enumerate(outer_bboxes):  # TODO: optimize this !!
            if doOverlap(bbox1, bbox2):
                overlap_indexes.append(i)
        for i in overlap_indexes:
            bbox2 = mergeBboxes(bbox2, outer_bboxes[i])
        for i in sorted(overlap_indexes, reverse=True):
            del outer_bboxes[i]
        outer_bboxes.append(bbox2)
    return outer_bboxes
1015909
def _interval_to_bound_points(array):
    

    array_boundaries = np.array([x.left for x in array])
    array_boundaries = np.concatenate(
        (array_boundaries, np.array([array[-1].right])))

    return array_boundaries
169525
def bounds(self):
        
        # return bounds including ONLY referenced vertices
        in_mesh = self.vertices[self.referenced_vertices]
        # get mesh bounds with min and max
        mesh_bounds = np.array([in_mesh.min(axis=0),
                                in_mesh.max(axis=0)])
        # should not be mutable
        mesh_bounds.flags.writeable = False
        return mesh_bounds
202
def get_bounds(self):
        

        size = self.get_size()
        top_left = self.get_position([0, 0])

        # t, r, b, l
        bounds = [top_left[1], top_left[0] + size[0], top_left[1] + size[1], top_left[0]]
        return bounds
669265
def to_dim_times_two(self, bounds):
        
        if not bounds:
            b = [[None, None]]
        else:
            l = [None, None]  # figure out lenths
            for i in [0, 1]:
                try:
                    l[i] = len(bounds[i])
                except TypeError:
                    bounds[i] = [bounds[i]]
                    l[i] = 1
            b = []  # bounds in different format
            try:
                for i in xrange(max(l)):
                    b.append([bounds[0][i] if i < l[0] else None,
                              bounds[1][i] if i < l[1] else None])
            except (TypeError, IndexError):
                print("boundaries must be provided in the form " +
                      "[scalar_of_vector, scalar_or_vector]")
                raise
        return b
1054563
def get_bounding_box(font):
    
    ymin = 0
    ymax = 0
    if font.sfntVersion == 'OTTO':
        ymin = font['head'].yMin
        ymax = font['head'].yMax
    else:
        for g in font['glyf'].glyphs:
            char = font['glyf'][g]
            if hasattr(char, 'yMin') and ymin > char.yMin:
                ymin = char.yMin
            if hasattr(char, 'yMax') and ymax < char.yMax:
                ymax = char.yMax
    return ymin, ymax
388241
def bounding_box(self):
        
        if self.world_coords:
            return self.world_obj.findSolid().BoundingBox()
        return self.local_obj.findSolid().BoundingBox()