Return a Shapely Polygon representing the convex hull formed by
    the stops of the given Feed.
334356
def compute_convex_hull(feed: "Feed") -> Polygon:
    
    m = sg.MultiPoint(feed.stops[["stop_lon", "stop_lat"]].values)
    return m.convex_hull
1128329
def shape(self):
        
        ndim = mx_int()
        pdata = ctypes.POINTER(mx_int)()
        check_call(_LIB.MXNDArrayGetShapeEx(
            self.handle, ctypes.byref(ndim), ctypes.byref(pdata)))
        if ndim.value == -1:
            return None
        else:
            return tuple(pdata[:ndim.value])
211593
def polygon(self):
            ''''''
            points = []
            for fp in self.points[1:]:
                    points.append((fp.lat, fp.lng))
            return points
154763
def build_shapes(pfeed):
    
    rows = []
    for shape, geom in pfeed.shapes[['shape_id',
      'geometry']].itertuples(index=False):
        if shape not in pfeed.shapes_extra:
            continue
        if pfeed.shapes_extra[shape] == 2:
            # Add shape and its reverse
            shid = shape + '-1'
            new_rows = [[shid, i, lon, lat]
              for i, (lon, lat) in enumerate(geom.coords)]
            rows.extend(new_rows)
            shid = shape + '-0'
            new_rows = [[shid, i, lon, lat]
              for i, (lon, lat) in enumerate(reversed(geom.coords))]
            rows.extend(new_rows)
        else:
            # Add shape
            shid = '{}{}{}'.format(shape, cs.SEP, pfeed.shapes_extra[shape])
            new_rows = [[shid, i, lon, lat]
              for i, (lon, lat) in enumerate(geom.coords)]
            rows.extend(new_rows)

    return pd.DataFrame(rows, columns=['shape_id', 'shape_pt_sequence',
      'shape_pt_lon', 'shape_pt_lat'])
794650
def _union_in_blocks(contours, block_size):
    

    n_contours = len(contours)
    for i in range(0, n_contours, block_size):
        j = min(i + block_size, n_contours)

        inners = []
        for c in contours[i:j]:
            p = _contour_to_poly(c)
            if p.type == 'Polygon':
                inners.append(p)
            elif p.type == 'MultiPolygon':
                inners.extend(p.geoms)
        holes = unary_union(inners)
        assert holes.is_valid

        yield holes
154156
def facets_on_hull(self):
        
        # facets plane, origin and normal
        normals = self.facets_normal
        origins = self.facets_origin

        # (n,3) convex hull vertices
        convex = self.convex_hull.vertices.view(np.ndarray).copy()

        # boolean mask for which facets are on convex hull
        on_hull = np.zeros(len(self.facets), dtype=np.bool)

        for i, normal, origin in zip(range(len(normals)), normals, origins):
            # a facet plane is on the convex hull if every vertex
            # of the convex hull is behind that plane
            # which we are checking with dot products
            dot = np.dot(normal, (convex - origin).T)
            on_hull[i] = (dot < tol.merge).all()

        return on_hull
1189423
def __shape(self):
        """"""
        f = self.__getFileObj(self.shp)
        record = _Shape()
        nParts = nPoints = zmin = zmax = mmin = mmax = None
        (recNum, recLength) = unpack(">2i", f.read(8))
        shapeType = unpack("<i", f.read(4))[0]
        record.shapeType = shapeType
        # For Null shapes create an empty points list for consistency
        if shapeType == 0:
            record.points = []
        # All shape types capable of having a bounding box
        elif shapeType in (3,5,8,13,15,18,23,25,28,31):
            record.bbox = _Array('d', unpack("<4d", f.read(32)))
        # Shape types with parts
        if shapeType in (3,5,13,15,23,25,31):
            nParts = unpack("<i", f.read(4))[0]
        # Shape types with points
        if shapeType in (3,5,8,13,15,23,25,31):
            nPoints = unpack("<i", f.read(4))[0]
        # Read parts
        if nParts:
            record.parts = _Array('i', unpack("<%si" % nParts, f.read(nParts * 4)))
        # Read part types for Multipatch - 31
        if shapeType == 31:
            record.partTypes = _Array('i', unpack("<%si" % nParts, f.read(nParts * 4)))
        # Read points - produces a list of [x,y] values
        if nPoints:
            record.points = [_Array('d', unpack("<2d", f.read(16))) for p in range(nPoints)]
        # Read z extremes and values
        if shapeType in (13,15,18,31):
            (zmin, zmax) = unpack("<2d", f.read(16))
            record.z = _Array('d', unpack("<%sd" % nPoints, f.read(nPoints * 8)))
        # Read m extremes and values
        if shapeType in (13,15,18,23,25,28,31):
            (mmin, mmax) = unpack("<2d", f.read(16))
            # Measure values less than -10e38 are nodata values according to the spec
            record.m = []
            for m in _Array('d', unpack("%sd" % nPoints, f.read(nPoints * 8))):
                if m > -10e38:
                    record.m.append(m)
                else:
                    record.m.append(None)
        # Read a single point
        if shapeType in (1,11,21):
            record.points = [_Array('d', unpack("<2d", f.read(16)))]
        # Read a single Z value
        if shapeType == 11:
            record.z = unpack("<d", f.read(8))
        # Read a single M value
        if shapeType in (11,21):
            record.m = unpack("<d", f.read(8))
        return record
698665
def from_shapely(sgeom, srid=None):
        
        if SHAPELY:
            WKBWriter.defaults["include_srid"] = True
            if srid:
                lgeos.GEOSSetSRID(sgeom._geom, srid)
            return Geometry(sgeom.wkb_hex)
        else:
            raise DependencyError("Shapely")
1089300
def get_array_shape(self, key):
        """"""
        data = self.model.get_data()
        return data[key].shape
1364351
def cutout_shape(self, shape_obj):
        

        view, mask = self.get_shape_view(shape_obj)

        # cutout our enclosing (possibly shortened) bbox
        data = self._slice(view)

        # mask non-containing members
        mdata = np.ma.array(data, mask=np.logical_not(mask))
        return mdata
687864
public Polygon getHull() {
    if(!ok) {
      computeConvexHull();
    }
    return new Polygon(points, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax());
  }
878640
def polygon(self, points, stroke=None, fill=None, stroke_width=1, disable_anti_aliasing=False):
        
        self.put(' <polygon points="')
        self.put(' '.join(['%s,%s' % p for p in points]))
        self.put('" stroke-width="')
        self.put(str(stroke_width))
        self.put('"')
        if fill:
            self.put(' fill="')
            self.put(fill)
            self.put('"')
        if stroke:
            self.put(' stroke="')
            self.put(stroke)
            self.put('"')
        if disable_anti_aliasing:
            self.put(' shape-rendering="crispEdges"')
        self.put('/>\n')
600201
def make_cutter(self):
        
        return cadquery.Workplane('XY') \
            .circle(self.access_diameter / 2) \
            .extrude(self.access_height)
214439
def hull(self):
        
        from scipy.spatial import ConvexHull
        if len(self.coordinates) >= 4:
            inds = ConvexHull(self.coordinates).vertices
            return self.coordinates[inds]
        else:
            return self.coordinates
348907
def shape(self) -> Tuple[int, ...]:
        
        return tuple(bins.bin_count for bins in self._binnings)
183830
def shape(self) -> Tuple[int, ...]:
        """"""
        return tuple(int(sub) for sub in self.ratios.shape)
195224
def shape(self, i=0):
        """"""
        shp = self.__getFileObj(self.shp)
        i = self.__restrictIndex(i)
        offset = self.__shapeIndex(i)
        if not offset:
            # Shx index not available so use the full list.
            shapes = self.shapes()
            return shapes[i]
        shp.seek(offset)
        return self.__shape()