splitFV - Partition a mesh into its connected components.

版本 2.0.0.0 (2.9 KB) 作者: 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 次下载
更新时间 2026/1/8

查看许可证

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;

引用格式

Sven (2026). splitFV - Partition a mesh into its connected components. (https://ww2.mathworks.cn/matlabcentral/fileexchange/27667-splitfv-partition-a-mesh-into-its-connected-components), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2025b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Polygons 的更多信息
版本 已发布 发行说明
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