zou123 发表于 2013-11-24 11:55:47

SPLITFV Splits faces and vertices



SPLITFV Splits faces and vertices into connected pieces
    FVOUT = SPLITFV(F,V) separates disconnected pieces inside a patch defined by faces (F) and
    vertices (V). FVOUT is a structure array with fields "faces" and "vertices". Each element of
    this array indicates a separately connected patch.

    FVOUT = SPLITFV(FV) takes in FV as a structure with fields "faces" and "vertices"

    For example:
      fullpatch.vertices = ;
      fullpatch.faces = ;
      figure, subplot(2,1,1), patch(fullpatch,'facecolor','r'), title('Unsplit mesh');
      splitpatch = splitFV(fullpatch);
      colours = lines(length(splitpatch));
      subplot(2,1,2), hold on, title('Split mesh');
      for i=1:length(splitpatch)
          patch(splitpatch(i),'facecolor',colours(i,:));
      end

    Note: faces and vertices should be defined such that faces sharing a coincident vertex reference
    the same vertex number, rather than having a separate vertice defined for each face (yet at the
    same vertex location). In other words, running the following command: size(unique(v,'rows') ==
    size(v) should return TRUE. An explicit test for this has not been included in this function so
    as to allow for the deliberate splitting of a mesh at a given location by simply duplicating
    those vertices.

页: [1]
查看完整版本: SPLITFV Splits faces and vertices