(self, vertex_mask=None, polygon_mask=None)
return subsurface
Create subsurface for efficient operations on subset of Surface

        - should specify either vertex_mask or polygon_mask
        - input vertex_mask is not necessarily the final vertex_mask used
            - final vertex_mask is always derived from polygon_mask
            - this prevents dangling vertices

        Parameters
        ----------
        - vertex_mask : boolean array
            - mask of which vertices to include
        - polygon_mask : boolean array
            - mask of which polygons to include
Create subsurface for efficient operations on subset of Surface
Create subsurface for efficient operations on subset of Surface
def create_subsurface(self, vertex_mask=None, polygon_mask=None):
        """Create subsurface for efficient operations on subset of Surface

        - should specify either vertex_mask or polygon_mask
        - input vertex_mask is not necessarily the final vertex_mask used
            - final vertex_mask is always derived from polygon_mask
            - this prevents dangling vertices

        Parameters
        ----------
        - vertex_mask : boolean array
            - mask of which vertices to include
        - polygon_mask : boolean array
            - mask of which polygons to include
        """

        if polygon_mask is None:

            if vertex_mask is None:
                raise Exception('must specify vertex_mask or polygon_mask')

            polygon_mask = (
                vertex_mask[self.polys[:, 0]]
                * vertex_mask[self.polys[:, 1]]
                * vertex_mask[self.polys[:, 2]]
            )

        # select only vertices that appear in a polygon of polygon_mask
        vertex_mask = np.zeros(self.pts.shape[0], dtype=bool)
        vertex_mask[self.polys[polygon_mask].flat] = True

        # build map from old index to new index
        # vertices not in the subsurface are represented with large numbers
        vertex_map = np.ones(self.pts.shape[0], dtype=np.int) * np.iinfo(np.int32).max
        vertex_map[vertex_mask] = range(vertex_mask.sum())

        # reindex vertices and polygons
        subsurface_vertices = self.pts[vertex_mask, :]
        subsurface_polygons = vertex_map[self.polys[polygon_mask, :]]

        # create subsurface
        subsurface = self.__class__(pts=subsurface_vertices, polys=subsurface_polygons)
        subsurface.subsurface_vertex_mask = vertex_mask
        subsurface.subsurface_vertex_map = vertex_map
        subsurface.subsurface_polygon_mask = polygon_mask

        return subsurface
def create_subsurface ( self , vertex_mask = None , polygon_mask = None ) : if polygon_mask is None : if vertex_mask is None : raise Exception ( 'must specify vertex_mask or polygon_mask' ) polygon_mask = ( vertex_mask [ self . polys [ : , 0 ] ] * vertex_mask [ self . polys [ : , 1 ] ] * vertex_mask [ self . polys [ : , 2 ] ] ) # select only vertices that appear in a polygon of polygon_mask vertex_mask = np . zeros ( self . pts . shape [ 0 ] , dtype = bool ) vertex_mask [ self . polys [ polygon_mask ] . flat ] = True # build map from old index to new index # vertices not in the subsurface are represented with large numbers vertex_map = np . ones ( self . pts . shape [ 0 ] , dtype = np . int ) * np . iinfo ( np . int32 ) . max vertex_map [ vertex_mask ] = range ( vertex_mask . sum ( ) ) # reindex vertices and polygons subsurface_vertices = self . pts [ vertex_mask , : ] subsurface_polygons = vertex_map [ self . polys [ polygon_mask , : ] ] # create subsurface subsurface = self . __class__ ( pts = subsurface_vertices , polys = subsurface_polygons ) subsurface . subsurface_vertex_mask = vertex_mask subsurface . subsurface_vertex_map = vertex_map subsurface . subsurface_polygon_mask = polygon_mask return subsurface