mesh_thicken

compas.datastructures.mesh_thicken(mesh, thickness=1.0, both=True)[source]

Thicken a mesh.

Parameters
  • mesh (compas.datastructures.Mesh) – A mesh to thicken.

  • thickness (float, optional) – The mesh thickness. This should be a positive value. Default is 1.0.

  • both (bool, optional) – If true, the mesh is thickened on both sides of the original. Otherwise, the mesh is thickened on the side of the positive normal.

Returns

thickened_mesh (compas.datastructures.Mesh) – The thickened mesh.

Raises

ValueError – If thickness is not a positive number.

Examples

>>> from compas.datastructures import Mesh, mesh_thicken
>>> 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]])
>>> thick = mesh_thicken(mesh)
>>> thick.is_closed()
True
>>> all(dist(mesh.vertex_coordinates(a), thick.vertex_coordinates(b)) == 1 for a, b in zip(mesh.vertices(), thick.vertices()))
True