how can I generate a 3d surface object from 3d vertex extracted from a blender .ply?
4 ビュー (過去 30 日間)
古いコメントを表示
I'm looking for a way to get the 3d vertex information extracted from a blender .ply file and generate a 3d closed surface object. I tried the following code:
%Load .ply file
ptCloud = pcread('monkey.ply');
%Acess the 3D vertex coordinates
coordinates=ptCloud.Location; x=double(coordinates(:,1)); y=double(coordinates(:,2)); z=double(coordinates(:,3));
%Generate a delaunay triangulation from 3d vertex coordinates
DT = delaunayTriangulation(x,y,z);
[T,Xb] = freeBoundary(DT); TR = triangulation(T,Xb);
P = incenter(TR); F = faceNormal(TR);
trisurf(T,Xb(:,1),Xb(:,2),Xb(:,3), ... 'FaceColor','cyan','faceAlpha',0.8); axis equal hold on quiver3(P(:,1),P(:,2),P(:,3), ... F(:,1),F(:,2),F(:,3),0.5,'color','r');
The result related to the above code is represented by the attached figure (a), but the desired result would be (b).
回答 (1 件)
Cris LaPierre
2020 年 3 月 20 日
Does it have to be a ply file? If you can export it as an stl file, the following code might meet your needs.
mnky = stlread("monkey.stl");
trimesh(mnky,'facecolor', 'b','edgecolor','b')
1 件のコメント
Christopher McBride
2020 年 12 月 14 日
If it does have to remain in a ply file, do you have any suggestions on going about it?
参考
カテゴリ
Help Center および File Exchange で Delaunay Triangulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!