我已经编写了 MATLAB 代码(如下所示),它制作了一条边,然后构建了从该边延伸的网格。我可以将图中的 3D 模型视为网格,但无法将此模型导出为 stl 或 obj 等 3d 对象。
我阅读了许多转换为 stl 的示例,其中使用了以下内容:
% Extract the surface mesh
M=isosurface(x,y,z,F,0);
tr=TriRep(M.faces,M.vertices);
figure('color','w'), h=trimesh(tr); axis equal
% Write to .stl
stlwrite('PillBoxExample.stl',tr.Triangulation,tr.X)
但在我的代码中,我只使用了网格:
figure;
M= surface(-finalLSF);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
我尝试了很多次来转换它,但仍然有错误。
代码:
Img = imread('MK2.jpg');
Img=double(Img(:,:,1));
%
% ... other code ...
%
figure;
M= mesh(-finalLSF);
hold on; contour(phi, [0,0], 'r','LineWidth',2);
str=['Final level set function, ', num2str(iter_outer*iter_inner+iter_refine), ' iterations'];
title(str);
axis on;