フィルターのクリア

Merge triangular faces of different meshes

34 ビュー (過去 30 日間)
Alberto Acri
Alberto Acri 2024 年 6 月 24 日 11:48
回答済み: Aman 2024 年 6 月 26 日 9:38
How can I create a matrix that unifies the triangular faces of one 3D figure with the triangular faces of another 3D figure?

採用された回答

Aman
Aman 2024 年 6 月 26 日 9:38
Hi Alberto,
From the data you shared, I understand that you have nodes and faces data for two separate geometries and wanted to have common faces and nodes data for the combined geometry.
In order to achieve your desired result, you can do something like I did in the code below, i.e., first combine the nodes, followed by calculating the adjusted face values for one of the geometry, and then, at last, find the combined face values for the whole geometry.
data = load('combination.mat');
%%
tri1 = triangulation(data.faces_sol_1,data.nodes_sol_1);
tri2 = triangulation(data.faces_sol_2,data.nodes_sol_2);
figure;
trisurf(tri1,'FaceColor','green');
hold on;
trisurf(tri2,'FaceColor','red');
hold off;
%%
nodes_combined = [data.nodes_sol_1; data.nodes_sol_2];
num_nodes1 = size(data.nodes_sol_1, 1);
faces2_adjusted = data.faces_sol_2 + num_nodes1;
faces_combined = [data.faces_sol_1; faces2_adjusted];
tri_combined = triangulation(faces_combined, nodes_combined);
figure;
trisurf(tri_combined,'FaceColor','blue');
I hope it helps!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputational Geometry についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by