splitFV - Partition a mesh into its connected components.

Version 2.0.0.0 (2,91 KB) von Sven
Splits a 2D or 3D mesh defined by faces and vertices into separately connected mesh pieces. [2025 update for vastly faster performance]
1,8K Downloads
Aktualisiert 8. Jan 2026

Lizenz anzeigen

SPLITFV Partition a mesh into its connected components.
FVARRAY = SPLITFV(FV) - FV is a struct with .faces and .vertices
FVARRAY = SPLITFV(F, V) - F is faces matrix, V is vertices matrix
FVARRAY = SPLITFV(TR) - TR is a MATLAB triangulation object
DESCRIPTION:
Connectivity is determined by mapping vertices to "nodes" in a graph.
By default, connectivity is strict (index-based), but can be adjusted
to weld vertices that are spatially coincident but indexed separately.
NAME-VALUE OPTIONS:
Tolerance - Determines how vertices are "connected" into a graph:
NaN (Default): Strict index connectivity. Only faces
sharing the exact same vertex index are connected.
0: Exact spatial connectivity. Vertices at identical
[x,y,z] coordinates are treated as shared nodes.
>0: Fuzzy spatial connectivity. Vertices within this
Euclidean distance are treated as shared nodes.
Note: Original node counts will not change - Tolerance
values only affects how meshes are split
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];
tiledlayout(2,1);
nexttile;
patch('Faces',fullpatch.faces,'Vertices',fullpatch.vertices,'FaceColor','r');
title('Unsplit Mesh'); axis tight equal; grid on;
splitpatch = splitFV(fullpatch);
nexttile; hold on;
colours = lines(length(splitpatch));
for i=1:length(splitpatch)
patch(splitpatch(i),'FaceColor',colours(i,:));
end
title('Split Mesh'); view(2); axis tight equal; grid on;

Zitieren als

Sven (2026). splitFV - Partition a mesh into its connected components. (https://de.mathworks.com/matlabcentral/fileexchange/27667-splitfv-partition-a-mesh-into-its-connected-components), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2025b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Polygons finden Sie in Help Center und MATLAB Answers
Version Veröffentlicht Versionshinweise
2.0.0.0

Major overhaul to improve performance (graph logic instead of iterative loops), allow a tolerance to handle splitting while keeping adjacent meshes together, and including triangulation objects

1.7.0.0

Implemented Christopher's amendment to fix bug in following connectivity matrix.

1.6.0.0

Updated icon (thanks Tom Clark!)

1.0.0.0