def compute(self): """ABC API""" Delaunay.__init__(self, self._points, self._furthest_site, self._incremental, self._qhull_options)
def compute(self): """ABC API""" self.id = "D({},{})".format(self._furthest_site, self._qhull_options) Delaunay.__init__(self, self._points, self._furthest_site, self._incremental, self._qhull_options)
def __init__(self, points): """ :param points: coordinates of the points to triangulate :type points: (npoints, ndim) numpy float array """ # most of the hard work is done here: Delaunay.__init__(self, points) # obtain the number of dimensions ndim = self.points.shape[1] # obtain the number of facets in the convex hull: nfacets = self.convex_hull.shape[0] # obtain the number of simplices: try: nsimplices = self.simplices.shape[0] except AttributeError: # this is necessary for outdated versions of scipy which # use the incorrect term "vertices" instead of "simplices" self.simplices = self.vertices nsimplices = self.simplices.shape[0] # create array representation of each facet in the convex hull: self.convex_hull_array = np.empty((nfacets, ndim, ndim), dtype=self.points.dtype) """Array representation of the facets which make up the convex hull""" for i in xrange(nfacets): for j in xrange(ndim): self.convex_hull_array[i, j, :] = self.points[self.convex_hull[i, j]] # create lookup array for facets: self.facet_to_simplex = np.empty((nfacets), dtype=self.simplices.dtype) """ Lookup array which gives the index of the simplex corresponding to each facet from the convex hull """ for i in xrange(nfacets): for j in xrange(nsimplices): if (set.issubset(set(self.convex_hull[i]), set(self.simplices[j]))): self.facet_to_simplex[i] = j break