def concatenate(cls, *args):
        """Concatenates an arbitrary number of meshes.

        Currently supports vertices, vertex colors, and faces.
        """
        nargs = len(args)
        if nargs == 1:
            return args[0]

        vs = [a.v for a in args if a.v is not None]
        vcs = [a.vc for a in args if a.vc is not None]
        fs = [a.f for a in args if a.f is not None]

        if vs and len(vs) != nargs:
            raise ValueError('Expected `v` for all args or none.')
        if vcs and len(vcs) != nargs:
            raise ValueError('Expected `vc` for all args or none.')
        if fs and len(fs) != nargs:
            raise ValueError('Expected `f` for all args or none.')

        # Offset face indices by the cumulative vertex count.
        face_offsets = np.cumsum([v.shape[0] for v in vs[:-1]])
        for offset, f in zip(face_offsets, fs[1:]):  # https://bitbucket.org/logilab/pylint/issues/603/operator-generates-false-positive-unused pylint: disable=unused-variable
            f += offset

        return Mesh(
            v=np.vstack(vs) if vs else None,
            vc=np.vstack(vcs) if vcs else None,
            f=np.vstack(fs) if fs else None,
        )
def concatenate ( cls , * args ) : nargs = len ( args ) if nargs == 1 : return args [ 0 ] vs = [ a . v for a in args if a . v is not None ] vcs = [ a . vc for a in args if a . vc is not None ] fs = [ a . f for a in args if a . f is not None ] if vs and len ( vs ) != nargs : raise ValueError ( 'Expected `v` for all args or none.' ) if vcs and len ( vcs ) != nargs : raise ValueError ( 'Expected `vc` for all args or none.' ) if fs and len ( fs ) != nargs : raise ValueError ( 'Expected `f` for all args or none.' ) face_offsets = np . cumsum ( [ v . shape [ 0 ] for v in vs [ : - 1 ] ] ) for offset , f in zip ( face_offsets , fs [ 1 : ] ) : f += offset return Mesh ( v = np . vstack ( vs ) if vs else None , vc = np . vstack ( vcs ) if vcs else None , f = np . vstack ( fs ) if fs else None , )
Concatenates an arbitrary number of meshes.

        Currently supports vertices, vertex colors, and faces.