mesh.Mesh.offset_implicit#
- Mesh.offset_implicit(distance, resolution=100)#
Offset a triangular surface Mesh using an implicit distance representation.
This method generates an offset by reconstructing a new surface at the given offset distance. Compared to the standard node-normal-based
offset(), this approach is significantly more robust for sharp corners and regions of high curvature. This method does not preserve the original mesh topology, so the number of nodes and elements in the output mesh will differ from the input. Consequently, this method is not suitable for applications that rely on node-to-node correspondence between the original and offset meshes (e.g. generation of volume mesh by connecting the original and new surface mesh).Parameters#
- distancefloat
Offset distance at which the new surface is generated. Positive values offset outward, negative values inward.
- resolutionint, optional
Resolution controlling the geometric fidelity of the offset surface. Higher values improve accuracy, especially near sharp features, but significantly increase computation time. Typical values are in the range 75–150. Default is 100.
Returns#
- Mesh
A new triangular Mesh representing the offset surface. The mesh has a different topology from the input mesh.
Important
Computational cost increases rapidly with the chosen resolution.
Note
This method is mainly intended for closed (watertight) surface meshes. When applied to open surfaces, the extracted offset surface may include unwanted extensions near the border of the mesh.
See Also#
Examples#
>>> M = shapes.sphere() >>> M_offset = M.offset_implicit(-0.5, resolution=50) >>> abs(M_offset.enclosed_volume() - 0.5236) < 3e-2 True