mesh.Mesh.close#
- Mesh.close(method='radial', fix=True)#
Close holes in a triangular Mesh.
This method fills all open boundary contours (holes) of a triangular surface mesh and returns a new, closed mesh.
Parameters#
- method{‘radial’, ‘border’}, optional
The algorithm used to fill each border contour.
'radial'(default): Adds a central point per hole and connects all border edges to this point. This method is fast and produces good results for smooth, nearly planar and convex borders, but introduces new vertices.'border': Progressively fills the hole by creating triangles along the border edges, working inward without introducing new points. This method is more robust for irregular or non-planar borders but can be slower on large holes.
- fixbool, optional
If
True(default), the resulting mesh is post-processed withfix_triangle_mesh()(e.g. fix normals).
Returns#
- Mesh
A new mesh in which all holes of the original mesh have been closed. If the mesh was already closed, the returned mesh is topologically equivalent to the input.
Notes#
This method is only implemented for meshes with
eltype='tri3'.The hole-filling operation can result in incorrect surfaces (e.g. intersecting triangles).
Examples#
>>> cir = shapes.circle() >>> cyl_open = cir.extrude(dir=2).convert("tri3") >>> print(cyl_open.n_nodes()) 48
>>> cyl_closed1 = cyl_open.close(method="border") >>> print(cyl_closed1.n_nodes()) 48
>>> cyl_closed2 = cyl_open.close(method="radial") >>> print(cyl_closed2.n_nodes()) 50