Try to extract a convex set of points from multiple input formats.

    Parameters
    ---------
    obj: Trimesh object
         (n,d) points
         (m,) Trimesh objects

    Returns
    --------
    points: (o,d) convex set of points
774073
def hull_points(obj, qhull_options='QbB Pp'):
    
    if hasattr(obj, 'convex_hull'):
        return obj.convex_hull.vertices

    initial = np.asanyarray(obj, dtype=np.float64)
    if len(initial.shape) != 2:
        raise ValueError('points must be (n, dimension)!')

    hull = spatial.ConvexHull(initial, qhull_options=qhull_options)
    points = hull.points[hull.vertices]

    return points
758824
def get_normed_points(point_array, norm): # good to go
    
    norm = float(norm)
    #floated_array = []
    #for p in point_array: # need to make sure each point is a float
        #floated_array.append(float(p))
    points = old_div(numpy.array(point_array), norm)
    return points
55504
def convex_conj(self):
        
        convex_conjs = [func.convex_conj for func in self.functionals]
        return SeparableSum(*convex_conjs)
146355
def coords(obj):
    
    # Handle recursive case first
    if 'features' in obj:
        for f in obj['features']:
            # For Python 2 compatibility
            # See https://www.reddit.com/r/learnpython/comments/4rc15s/yield_from_and_python_27/ # noqa: E501
            for c in coords(f):
                yield c
    else:
        if isinstance(obj, (tuple, list)):
            coordinates = obj
        elif 'geometry' in obj:
            coordinates = obj['geometry']['coordinates']
        else:
            coordinates = obj.get('coordinates', obj)
        for e in coordinates:
            if isinstance(e, (float, int)):
                yield tuple(coordinates)
                break
            for f in coords(e):
                yield f
1321876
def convex_hull(self):
        
        points = util.vstack_empty([m.vertices for m in self.dump()])
        hull = convex.convex_hull(points)
        return hull
1372153
def get_convex_polygons(self, m, print_out=False):
        
        convex_polygons = []
        for corners in itertools.combinations(np.arange(self.N), m):
            p = np.zeros(m, np.uint)
            p[0] = corners[0]
            left = corners[1:]
            # loop through second corners
            for i, second in enumerate(corners[1:m - 1]):
                p[1] = second
                left = np.delete(corners, (0, i + 1))
                for j, last in enumerate(corners[i + 2:]):
                    left = np.delete(corners, (0, i + 1, j + i + 2))
                    p[-1] = last
                    # loop through all permutations of left corners.
                    for permut in itertools.permutations(left):
                        p[2:-1] = permut
                        sum_theta = 0
                        # sum over all inner angles.
                        for k in range(m):
                            sum_theta += self.get_inner_angle(
                                p[1], (p[0], p[2]))
                            p = np.roll(p, 1)
                        angle = sum_theta
                        sum_angle = (m - 2) * pi
                        if (abs(angle - sum_angle) < 1e-14 or
                                abs(angle) < 1e-14):
                            if (print_out):
                                print("convex polygon found:    ", p)
                            convex_polygons.append(p.copy())
                        #  elif (angle < sum_angle):
                        #  if (print_out): print("non convex polygon found:",p,angle)
                        elif (angle > sum_angle):
                            if (print_out):
                                print("oops")
        return convex_polygons
708559
def sweObjectLon(obj, jd):
    
    sweObj = SWE_OBJECTS[obj]
    sweList = swisseph.calc_ut(jd, sweObj)
    return sweList[0]
333540
def f(self, m):
        '''  '''
        M = reshape(m,self.input_dim)
        n = M.shape[0]
        if M.shape[1] != self.input_dim:
            return 'Wrong input dimension'
        else:
            S = self.environment.update(M)
            m = M[0]
            s = S[0]
            # Store the points (m,s) explored during the optimisation
            self.pointsList.append((m,s))
            return self.dist_array(S)
220928
def gaussian_polygons(points, n=10):
    
    gdf = gpd.GeoDataFrame(data={'cluster_number': classify_clusters(points, n=n)}, geometry=points)
    polygons = []
    for i in range(n):
        sel_points = gdf[gdf['cluster_number'] == i].geometry
        polygons.append(shapely.geometry.MultiPoint([(p.x, p.y) for p in sel_points]).convex_hull)
    polygons = [p for p in polygons if
                (not isinstance(p, shapely.geometry.Point)) and (not isinstance(p, shapely.geometry.LineString))]
    return gpd.GeoSeries(polygons)
378231
def fix_trim_curves(obj):
    
    # Validate input
    if obj.pdimension != 2:
        raise GeomdlException("Input geometry must be a surface")

    # Get trims of the surface
    for o in obj:
        trims = o.trims
        if not trims:
            continue

        # Get parameter space bounding box
        parbox = get_par_box(o.domain, True)

        # Check and update trim curves with respect to the underlying surface
        updated_trims = []
        for trim in trims:
            flag, trm = check_trim_curve(trim, parbox)
            if flag:
                if trm:
                    cont = shortcuts.generate_container_curve()
                    cont.add(trm)
                    updated_trims.append(cont)
                else:
                    updated_trims.append(trim)

        # Set updated trims
        obj.trims = updated_trims
1221728
def face_midpoints(self, simplices=None):
        

        if type(simplices) == type(None):
            simplices = self.simplices

        mids = self.points[simplices].mean(axis=1)
        mids /= np.linalg.norm(mids, axis=1).reshape(-1,1)

        midlons, midlats = xyz2lonlat(mids[:,0], mids[:,1], mids[:,2])

        return midlons, midlats
511952
def from_gpx(gpx_segment):
        
        points = []
        for point in gpx_segment.points:
            points.append(Point.from_gpx(point))
        return Segment(points)
433378
def from_dict(cls, obj_dict):
        
        default_model = Concise()
        cvdc = ConciseCV(default_model)
        cvdc._from_dict(obj_dict)
        return cvdc
897868
def extract_line(geom, dem, **kwargs):
    
    kwargs.setdefault('masked', True)

    coords_in = coords_array(geom)

    # Transform geometry into pixels
    f = lambda *x: ~dem.transform * x
    px = transform(f,geom)

    # Subdivide geometry segments if option is given
    interval = kwargs.pop('subdivide', 1)
    if interval is not None:
        px = subdivide(px, interval=interval)

    # Transform pixels back to geometry
    # to capture subdivisions
    f = lambda *x: dem.transform * (x[0],x[1])
    geom = transform(f,px)

    # Get min and max coords for windowing
    # Does not deal with edge cases where points
    # are outside of footprint of DEM

    coords_px = coords_array(px)
    mins = N.floor(coords_px.min(axis=0))
    maxs = N.ceil(coords_px.max(axis=0))

    window = tuple((int(mn),int(mx))
        for mn,mx in zip(mins[::-1],maxs[::-1]))

    aff = Affine.translation(*(-mins))

    f = lambda *x: aff * x
    px_to_extract = transform(f,px)

    band = dem.read(1, window=window, **kwargs)
    extracted = bilinear(band, px_to_extract)
    coords = coords_array(extracted)

    coords[:,:2] = coords_array(geom)
    return coords
1170766
def _dump_multipoint(obj, decimals):
    
    coords = obj['coordinates']
    mp = 'MULTIPOINT (%s)'
    points = (' '.join(_round_and_pad(c, decimals)
                       for c in pt) for pt in coords)
    # Add parens around each point.
    points = ('(%s)' % pt for pt in points)
    mp %= ', '.join(points)
    return mp
454110
def process_parsed_coords(coords):
    
    geometry = np.zeros(shape=(len(coords), 3), dtype=float)
    for ii, entry in enumerate(coords):
        for jj in range(3):
            geometry[ii, jj] = float(entry[jj])
    return geometry
1028790
private double[][] getPoints(Geometry input) {
        double[][] result = new double[input.getNumPoints()][];
        for (int i = 0; i < input.getPoints().size(); i++) {
            Point p = input.getPointN(i);
            if(p.isMeasured() && p.is3D()) {
                result[i] = new double[]{p.getX(), p.getY(), p.getZ(), p.getM()};
            } else if(p.isMeasured()) {
                // ideally we'd use something like Double.Nan, but JSON doesn't support that.
                result[i] = new double[]{p.getX(), p.getY(), 0, p.getM()};
            } else if(p.is3D()) {
                result[i] = new double[]{p.getX(), p.getY(), p.getZ()};
            } else {
                result[i] = new double[]{p.getX(), p.getY()};
            }
        }
        return result;
    }