Hi Ansgar,
I understand that you are looking for meshing the volume into tetrahedrons. But tetrahedron triangulation is not supported by 'stlwrite'. However, you can follow the steps below to get started:
- Extract the vertices from the 3D model, using the Vertices property of 'DiscreteGeometry' object:
X_=g2.Vertices(:,1);
Y_=g2.Vertices(:,2);
- Use the 'delaunayTriangulation' object to create a 2-D or 3-D 'Delaunay triangulation' from the set of vertices as follows:
DT=delaunayTriangulation([X_,Y_]);
- Explore the 'ConnectivityList' Property of the object DT.
- (optional step) Using the connectivity list as stated above, create a 'triangulation' object:
tri=triangulation(DT.ConnectivityList,X_,Y_);
- Finally, using the 'stlwrite' function, output this geometry into an STL file:
stlwrite(tri,"output.stl");