Computes the bounding box of an iterable of (x, y) coordinates.

    Args:
        locations: iterable of (x, y) tuples.

    Returns:
        `Rect`: Coordinates of the bounding box.
967507
def bounding_box(locations):
    
    x_values = list(map(itemgetter(0), locations))
    x_min, x_max = min(x_values), max(x_values)
    y_values = list(map(itemgetter(1), locations))
    y_min, y_max = min(y_values), max(y_values)
    return Rect(x_min, y_min, x_max - x_min, y_max - y_min)
592597
def GetStopsInBoundingBox(self, north, east, south, west, n):
    """"""
    stop_list = []
    for s in self.stops.values():
      if (s.stop_lat <= north and s.stop_lat >= south and
          s.stop_lon <= east and s.stop_lon >= west):
        stop_list.append(s)
        if len(stop_list) == n:
          break
    return stop_list
116989
def bounding_polygon(self):
        
        lon_left, lat_bottom, lon_right, lat_top = Tile.tile_coords_to_bbox(self.x, self.y, self.zoom)
        print(lon_left, lat_bottom, lon_right, lat_top)
        return Polygon([[[lon_left, lat_top],
                       [lon_right, lat_top],
                       [lon_right, lat_bottom],
                       [lon_left, lat_bottom],
                       [lon_left, lat_top]]])
1143186
def _select_position(self, w, h): 
        
        fitn = ((m.y+h, m.x, w, h, m) for m in self._max_rects 
                if self._rect_fitness(m, w, h) is not None)
        fitr = ((m.y+w, m.x, h, w, m) for m in self._max_rects 
                if self._rect_fitness(m, h, w) is not None)

        if not self.rot:
            fitr = []

        fit = itertools.chain(fitn, fitr)
        
        try:
            _, _, w, h, m = min(fit, key=first_item)
        except ValueError:
            return None, None

        return Rectangle(m.x, m.y, w, h), m
109629
def element_coordinates(cls, element):
        
        out = (0, 0, 0, 0)
        if 'title' in element.attrib:
            matches = cls.box_pattern.search(element.attrib['title'])
            if matches:
                coords = matches.group(1).split()
                out = Rect._make(int(coords[n]) for n in range(4))
        return out
113630
def getUnionLocations(encoder, x, y, r, step=1):
  
  output = np.zeros(encoder.getWidth(), dtype=defaultDtype)
  locations = set()
  for dx in range(-r, r+1, step):
    for dy in range(-r, r+1, step):
      if dx*dx + dy*dy <= r*r:
        e = encodeLocation(encoder, x+dx, y+dy, output)
        locations = locations.union(set(e))

  return locations
834283
def get_locations_from_coords(self, longitude, latitude, levels=None):
        
        resp = requests.get(SETTINGS['url'] + '/point/4326/%s,%s?generation=%s' % (longitude, latitude, SETTINGS['generation']))
        resp.raise_for_status()

        geos = []
        for feature in resp.json().itervalues():
            try:
                geo = self.get_geography(feature['codes']['MDB'],
                                         feature['type_name'].lower())

                if not levels or geo.geo_level in levels:
                    geos.append(geo)
            except LocationNotFound as e:
                log.warn("Couldn't find geo that Mapit gave us: %s" % feature, exc_info=e)

        return geos
665601
def _get_bounds_local(layers):
    
    if not layers:
        return {'west': None, 'south': None, 'east': None, 'north': None}

    bounds = layers[0].bounds

    for layer in layers[1:]:
        bounds = np.concatenate(
            (
                np.minimum(
                    bounds[:2],
                    layer.bounds[:2]
                ),
                np.maximum(
                    bounds[2:],
                    layer.bounds[2:]
                )
            )
        )

    return dict(zip(['west', 'south', 'east', 'north'], bounds))
302831
def positions(self, x, y):
        # type: (int, int) -> List[(Point, Point)]
        
        return [(Point(x, v), Point(x + 1 + v, y - 1 - v)) for v in range(y)]
316177
def coordinates_inside_data(
        self,
        x,
        y
        ):

        

        return (self.min_x <= x < self.max_x) and (self.min_y <= y < self.max_y)
472469
def from_points(lons, lats):
        
        north, west = max(lats), min(lons)
        south, east = min(lats), max(lons)
        return BoundingBox(north=north, west=west, south=south, east=east)
139848
function getAllNearPositions(position) {
    return [[-1, -1], [0, -1], [1, -1], [-1, 0], [1, 0], [-1, 1], [0, 1], [1, 1] // Below positions
    ].map(function (toAdd) {
        return {
            x: position.x + toAdd[0],
            y: position.y + toAdd[1]
        };
    });
}
1286293
public void getBounds(Rect bounds) {
        final int r = (int) Math.ceil(mTargetRadius);
        bounds.set(-r, -r, r, r);
    }
751664
def bbox(self):
        

        return BoundingBox(self.slices[1].start, self.slices[1].stop,
                           self.slices[0].start, self.slices[0].stop)
117498
def coordinates(self):
        

        angles = self.values[0]
        radii = self.values[1]
        x = np.zeros(len(angles))
        y = np.zeros(len(angles))

        for i in range(len(x)):
            x[i] = (radii[i] * np.cos(angles[i] + self.geometry.pa) +
                    self.geometry.x0)

            y[i] = (radii[i] * np.sin(angles[i] + self.geometry.pa) +
                    self.geometry.y0)

        return x, y
1290350
def get_position(self):
        
        with self._lock:
            return self.x, self.y, self.angle
1233230
def bounding_box(positions):
    '''
    '''
    (x0, y0, z0) = (x1, y1, z1) = positions[0]
    for x, y, z in positions:
        x0 = min(x0, x)
        y0 = min(y0, y)
        z0 = min(z0, z)
        x1 = max(x1, x)
        y1 = max(y1, y)
        z1 = max(z1, z)
    return (x0, y0, z0), (x1, y1, z1)