SPLITMESH Return the connected components of a mesh.

   MESHES = splitMesh(VERTICES, FACES) returns the connected components of
   the mesh defined by vertices and faces as a struct array with the  
   fields vertices and faces sorted by increasing vertex number

   MESHES = splitMesh(MESH) with the vertices-faces-struct MESH is also
   possible
   
   ... = splitMesh(..., 'mostVertices') returns only the component with
   the most vertices. Other options are 'all' (default),
   'maxBoundingBox' that returns the component with the largest bounding 
   box, and 'maxVolume' returns the component with the largest volume.


   Example
     [v1, f1] = boxToMesh([1 0 -1 0 -1 0]);
     [v2, f2] = boxToMesh([-1 0 1 0 -1 0]);
     [v3, f3] = createSoccerBall;
     f1 = triangulateFaces(f1);
     f2 = triangulateFaces(f2);
     f3 = triangulateFaces(f3);
     [vertices, faces] = concatenateMeshes(v1, f1, v3, f3, v2, f2);
     meshes = splitMesh(vertices, faces);
     figure('color','w'); view(3); axis equal
     cmap=hsv(length(meshes));
     for m=1:length(meshes)
         drawMesh(meshes(m), cmap(m,:))
     end

   See also
     concatenateMeshes

   Source
     Local functions are part of the gptoolbox of Alec Jacobson
     https://github.com/alecjacobson/gptoolbox

 ---------
 Author: oqilipo
 Created: 2017-09-17
 Copyright 2017

Package: matgeom