mesh.Mesh.offset#
- Mesh.offset(distance=1.0)#
Offset a surface mesh along its averaged nodal normals.
This method moves each node of the mesh along an averaged normal direction by a given distance. The nodal normal is computed as the average of the normals of all elements sharing that node.
Supported element types are:
tri3: normals are computed directly.quad4: the mesh is internally converted totri3for normal computation.
Parameters#
- distancefloat, optional
Distance over which the points should be moved. Positive values offset the mesh in the direction of the averaged normals. Default is 1.0.
Returns#
- Mesh
A Mesh of the same element type as the input mesh, obtained by moving each node along its averaged normal vector by the specified distance.
See Also#
Examples#
>>> M_quad = Mesh(eltype='quad4') >>> M_tri = M_quad.convert('tri3') >>> M_tri2 = M_tri.offset(distance=1.0) >>> print(M_tri2.coords) [[0. 0. 1.] [1. 0. 1.] [1. 1. 1.] [0. 1. 1.]]
>>> M_quad2 = M_quad.offset(distance=-0.5) >>> print(M_quad2.coords) [[ 0. 0. -0.5] [ 1. 0. -0.5] [ 1. 1. -0.5] [ 0. 1. -0.5]]