Returns points on convex hull of an array of points in CCW order.
975442
def convex_hull(features):
    """"""
    points = sorted([s.point() for s in features])
    l = reduce(_keep_left, points, [])
    u = reduce(_keep_left, reversed(points), [])
    return l.extend(u[i] for i in xrange(1, len(u) - 1)) or l
1243878
function(array){
                array = array || [];
                var n = 0;
                for(i=0; i<this.vertices.length; i++){
                    var v = this.vertices[i];
                    array[n++] = v.normal.x;
                    array[n++] = v.normal.y;
                    array[n++] = v.normal.z;
                }

                return array;
            }
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
158804
function pointsArray (buf, offset, numPoints) {
    var pointsData = []
    for (var i = offset; i < offset + numPoints * 12; i += 12) {
      pointsData.push([buf.readFloatLE(i + 0), buf.readFloatLE(i + 4), buf.readFloatLE(i + 8)])
    }
    return pointsData
  }
1210662
def convex_hull(self):
        
        bnodes, nb, na, nt = _tripack.bnodes(self.lst, self.lptr, self.lend, self.npoints)
        return self._deshuffle_simplices(bnodes[:nb] - 1)
1166378
private void computeConvexHull() {
    // Trivial cases
    if(points.size() < 3) {
      this.ok = true;
      return;
    }
    // Avoid numerical instabilities by rescaling
    double maxX = Math.max(Math.abs(minmaxX.getMin()), Math.abs(minmaxX.getMax()));
    double maxY = Math.max(Math.abs(minmaxY.getMin()), Math.abs(minmaxY.getMax()));
    if(maxX < 10.0 || maxY < 10.0) {
      factor = 10 / maxX;
      if(10 / maxY > factor) {
        factor = 10 / maxY;
      }
    }
    // Find the new origin point
    findStartingPoint();
    // Sort points for the scan
    final double[] origin = points.get(0);
    Collections.sort(this.points, new Comparator<double[]>() {
      @Override
      public int compare(double[] o1, double[] o2) {
        return isLeft(o1, o2, origin);
      }
    });
    grahamScan();
    this.ok = true;
  }
1030981
public List<Point> getMazePoints() {
        List<Point> points = new ArrayList<Point>();
        for (int row = 0; row < this.rows; row++) {
            for (int column = 0; column < this.columns; column++) {
                points.add(new Point(column, row));
            }
        }
        return points;
    }
1035312
function() {
            if (!this.cachedBoundingBox) {
                var minpoint, maxpoint;
                var vertices = this.vertices;
                var numvertices = vertices.length;
                if (numvertices === 0) {
                    minpoint = new CSG.Vector3D(0, 0, 0);
                } else {
                    minpoint = vertices[0].pos;
                }
                maxpoint = minpoint;
                for (var i = 1; i < numvertices; i++) {
                    var point = vertices[i].pos;
                    minpoint = minpoint.min(point);
                    maxpoint = maxpoint.max(point);
                }
                this.cachedBoundingBox = [minpoint, maxpoint];
            }
            return this.cachedBoundingBox;
        }
500422
def fill_convex_hulls(ch_pts, ch_counts):
    '''
    '''
    if len(ch_pts) == 0:
        return np.zeros((0,3), int)
    #
    # Connect the last line to the first
    #
    ch_counts = ch_counts[ch_counts != 0]
    indexer_in = Indexes(ch_counts)
    #
    # Get line ends. This involves connecting the last
    # point with the first.
    #
    idx_1 = np.arange(ch_pts.shape[0]) + 1
    idx_1[indexer_in.fwd_idx+indexer_in.counts - 1] = indexer_in.fwd_idx
    ch_pts1 = ch_pts[idx_1, 1:]
    #
    # Get J at each I (floating point) for each line
    # Generate two points (min J, max J) for horizontal lines
    #
    n_i = np.abs(ch_pts[:, 1] - ch_pts1[:, 0]) + 1
    horizontal = n_i == 1
    if (np.any(horizontal)):
        i_horiz = ch_pts[horizontal, 1]
        l_horiz = ch_pts[horizontal, 0]
        j_first_horiz = ch_pts[horizontal, 2]
        j_last_horiz = ch_pts1[horizontal, 1]
    else:
        i_horiz = l_horiz = j_first_horiz = j_last_horiz = np.zeros(0, int)
    
    if (np.any(~ horizontal)):
        ch_pts, ch_pts1, n_i = [x[~horizontal] for x in (ch_pts, ch_pts1, n_i)]
        indexer = Indexes(n_i)
        l = ch_pts[indexer.rev_idx, 0]
        sign = np.sign(ch_pts1[:, 0] - ch_pts[:, 1])
        i = ch_pts[indexer.rev_idx, 1] + sign[indexer.rev_idx] * indexer.idx[0]
        j = ch_pts[indexer.rev_idx, 2] + \
            indexer.idx[0] * (ch_pts1[indexer.rev_idx, 1] - 
                              ch_pts[indexer.rev_idx, 2]).astype(float) / \
            (n_i[indexer.rev_idx] - 1)
    else:
        i = l = np.zeros(0, int)
        j = np.zeros(0)
    line_labels = np.concatenate((l_horiz, l_horiz, l))
    i = np.concatenate((i_horiz, i_horiz, i))
    j = np.concatenate((j_first_horiz.astype(float),
                        j_last_horiz.astype(float), j))
    #
    # Sort by label, then i, then j
    #
    order = np.lexsort((j, i, line_labels))
    i, j, line_labels = i[order], j[order], line_labels[order]
    #
    # Find the min and max j for every i and label. Then we
    # can make runs of them.
    #
    firsts = np.hstack(
        [[0], 
         np.argwhere((line_labels[:-1] != line_labels[1:]) | 
                     (i[:-1] != i[1:])).flatten() + 1, 
         [len(line_labels)]])
    counts = firsts[1:] - firsts[:-1]
    run_indexer = Indexes(counts)
    #
    # Find the first and last J for each i and create rasters of j
    #
    i = i[run_indexer.fwd_idx]
    j0 = np.ceil(j[run_indexer.fwd_idx]).astype(int)
    j1 = np.floor(j[run_indexer.fwd_idx + run_indexer.counts[0]-1]).astype(int)
    l = line_labels[run_indexer.fwd_idx]
    out_indexer = Indexes(j1-j0+1)
    ijv = np.column_stack((
        i[out_indexer.rev_idx], j0[out_indexer.rev_idx]+out_indexer.idx[0],
        l[out_indexer.rev_idx]))
    return ijv
1368615
def pointlist(points, sr):
    """"""
    assert all(isinstance(pt, Point) or len(pt) == 2 
               for pt in points), "Point(s) not in [x, y] form"
    return [coord if isinstance(coord, Point) 
                  else Point(coord[0], coord[1], sr)
            for coord in points]
882950
private Polygon computeConvexHull() {
    GrahamScanConvexHull2D inner = new GrahamScanConvexHull2D();
    for(double[] point : points) {
      if(checkCandidate(point)) {
        inner.add(point);
      }
    }
    return inner.getHull();
  }
527802
def computeDelaunayTriangulation(points):
    
    siteList = SiteList(points)
    context  = Context()
    context.triangulate = True
    voronoi(siteList,context)
    return context.triangles
851510
def points(self, points):
        
        if not isinstance(points, np.ndarray):
            raise TypeError('Points must be a numpy array')
        # get the unique coordinates along each axial direction
        x = np.unique(points[:,0])
        y = np.unique(points[:,1])
        z = np.unique(points[:,2])
        nx, ny, nz = len(x), len(y), len(z)
        # TODO: this needs to be tested (unique might return a tuple)
        dx, dy, dz = np.unique(np.diff(x)), np.unique(np.diff(y)), np.unique(np.diff(z))
        ox, oy, oz = np.min(x), np.min(y), np.min(z)
        # Build the vtk object
        self._from_specs((nx,ny,nz), (dx,dy,dz), (ox,oy,oz))
        #self._point_ref = points
        self.Modified()
396245
def build_grad_matrices(V, points):
    
    # See <https://www.allanswered.com/post/lkbkm/#zxqgk>
    mesh = V.mesh()

    bbt = BoundingBoxTree()
    bbt.build(mesh)
    dofmap = V.dofmap()
    el = V.element()
    rows = []
    cols = []
    datax = []
    datay = []
    for i, xy in enumerate(points):
        cell_id = bbt.compute_first_entity_collision(Point(*xy))
        cell = Cell(mesh, cell_id)
        coordinate_dofs = cell.get_vertex_coordinates()

        rows.append([i, i, i])
        cols.append(dofmap.cell_dofs(cell_id))

        v = el.evaluate_basis_derivatives_all(1, xy, coordinate_dofs, cell_id)
        v = v.reshape(3, 2)
        datax.append(v[:, 0])
        datay.append(v[:, 1])

    rows = numpy.concatenate(rows)
    cols = numpy.concatenate(cols)
    datax = numpy.concatenate(datax)
    datay = numpy.concatenate(datay)

    m = len(points)
    n = V.dim()
    dx_matrix = sparse.csr_matrix((datax, (rows, cols)), shape=(m, n))
    dy_matrix = sparse.csr_matrix((datay, (rows, cols)), shape=(m, n))
    return dx_matrix, dy_matrix
1017052
def points(self):
        
        points = matrix_to_points(matrix=self.matrix,
                                  pitch=self.pitch,
                                  origin=self.origin)
        return points
941080
public float[] getPoint(int index) {
        checkPoints();

        float result[] = new float[2];
        
        result[0] = points[index * 2];
        result[1] = points[index * 2 + 1];
        
        return result;
    }
381968
def simplices(self):
        
        return [Simplex([self.points[i] for i in v]) for v in self.vertices]