Code covered by the BSD License  

Highlights from
splitFV - split a mesh

5.0

5.0 | 2 ratings Rate this file 16 Downloads (last 30 days) File Size: 2.21 KB File ID: #27667
image thumbnail

splitFV - split a mesh

by Sven

 

19 May 2010 (Updated 03 Feb 2012)

Splits a 2D or 3D mesh defined by faces and vertices into separately connected mesh pieces.

| Watch this File

File Information
Description

  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 = [2 4; 2 8; 8 4; 8 0; 0 4; 2 6; 2 2; 4 2; 4 0; 5 2; 5 0];
    fullpatch.faces = [1 2 3; 1 3 4; 5 6 1; 7 8 9; 11 10 4];
    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.

  See also PATCH

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
22 Dec 2011 Thomas Clark

This did exactly what I wanted, straight out of the box, without editing a single line of code.

That's my kind of FEX submission!

NB For users wondering about this, it works in 3D too.

Sven, would you like some JPEGs of it decomposing different vortices in a fluid flow?

06 Feb 2012 Sven

Thanks for the images Tom :)

24 May 2012 Anton Semechko  
Please login to add a comment or rating.
Updates
03 Feb 2012

Updated icon (thanks Tom Clark!)

Tag Activity for this File
Tag Applied By Date/Time
mesh Sven 20 May 2010 10:04:08
separate Sven 20 May 2010 10:04:08
split Sven 20 May 2010 10:04:08
stl Sven 20 May 2010 10:04:08
faces Sven 20 May 2010 10:04:08
vertices Sven 20 May 2010 10:04:08
patch Sven 20 May 2010 10:04:08

Contact us at files@mathworks.com