mesh_offset
- compas.datastructures.mesh_offset(mesh, distance=1.0)[source]
Offset a mesh.
- Parameters
mesh (
compas.datastructures.Mesh
) – A Mesh to offset.distance (float, optional) – The offset distance. Default is
1.0
.
- Returns
compas.datastructures.Mesh
– The offset mesh.
Notes
If the offset distance is a positive value, the offset is in the direction of the vertex normal. If the value is negative, the offset is in the opposite direction. In both cases, the orientation of the offset mesh is the same as the orientation of the original.
In areas with high degree of curvature, the offset mesh can have self-intersections.
Examples
>>> from compas.datastructures import Mesh, mesh_offset >>> from compas.geometry import distance_point_point as dist >>> mesh = Mesh.from_vertices_and_faces([[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]], [[0, 1, 2, 3]]) >>> offset = mesh_offset(mesh) >>> all(dist(mesh.vertex_coordinates(a), offset.vertex_coordinates(b)) == 1 for a, b in zip(mesh.vertices(), offset.vertices())) True