Separate multiple triangulat​ion.Connec​tivityList based on connectivity

5 visualizaciones (últimos 30 días)
Hello, I have a triangulation object which when plotted using the patch command produces multiple non-enclosed faceted surfaces.
I would like to find a way to separate out all discrete surfaces into distinct triangulation.ConnectivityList or triangulation objects. I started implementing this using the triangulation function isConnected(), which only considers connectivity along a single edge and ultimately begs for a recursive solution. I wondered if there was a simpler or already implemented solution to accomplish this task.
I've extended the example in triangulation doc to include two distinct faceted surfaces. Thanks in advance for your help!
P = [ 2.5 8.0 1
6.5 8.0 1
2.5 5.0 1
6.5 5.0 1
1.0 6.5 1
8.0 6.5 1];
P = [ P;
2.5 8.0 3
6.5 8.0 3
2.5 5.0 3
6.5 5.0 3
1.0 6.5 3
8.0 6.5 3]
P = 12×3
2.5000 8.0000 1.0000 6.5000 8.0000 1.0000 2.5000 5.0000 1.0000 6.5000 5.0000 1.0000 1.0000 6.5000 1.0000 8.0000 6.5000 1.0000 2.5000 8.0000 3.0000 6.5000 8.0000 3.0000 2.5000 5.0000 3.0000 6.5000 5.0000 3.0000
T = [5 3 1;
3 2 1;
3 4 2;
4 6 2];
T = [T;
11 9 7;
9 8 7;
9 10 8;
10 12 8]
T = 8×3
5 3 1 3 2 1 3 4 2 4 6 2 11 9 7 9 8 7 9 10 8 10 12 8
TR = triangulation(T,P)
TR =
triangulation with properties: Points: [12×3 double] ConnectivityList: [8×3 double]
h1 = patch('faces',TR.ConnectivityList,'vertices',TR.Points);
set(h1,'FaceColor',[.89 .855 .788], 'FaceLighting','gouraud','EdgeColor','none','FaceAlpha',0.5,'SpecularStrength',.1);
lighting phong;
axis equal
xlabel('x');ylabel('y');zlabel('z')
view([0 40])

Respuesta aceptada

Donald Hume
Donald Hume el 3 de Ag. de 2022
I spent a good deal of time searching the internet for an answer to this problem, however it's never enough.
@Sven has a great solution described on File Exchange: SplitFV. Thanks, Sven!

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by