mesh_flatness

compas.datastructures.mesh_flatness(mesh, maxdev=1.0)[source]

Compute mesh flatness per face.

Parameters
  • mesh (Mesh) – A mesh object.

  • maxdev (float, optional) – A maximum value for the allowed deviation from flatness.

Returns

dict[int, float] – For each face, a deviation from flatness.

Notes

The “flatness” of a face is expressed as the ratio of the distance between the diagonals to the average edge length. For the fabrication of glass panels, for example, 0.02 could be a reasonable maximum value.

Warning

This function only works as expected for quadrilateral faces.