mesh.Mesh.partition_by_angle#

Mesh.partition_by_angle(angle=60.0, sort='number')#

Partition a tri3 Mesh by splitting it at sharp edges.

The Mesh is partitioned in parts in which all elements can be reached without ever crossing a sharp edge angle. More precisely, any two triangles will belong to the same part if the can be connected by a line in the surface that does not cross an edge between two elements having their normals differ more than the specified angle.

Parameters#

angle: float

The minimum value of the angle (in degrees) between the normals on two adjacent triangles in order for the edge to be considered a sharp edge.

sort: str

Defines how the resulting parts are sorted (by assigning them increasing part numbers). The following sort criteria are currently defined (any other value will return the parts unsorted):

  • ‘number’: sort in decreasing order of the number of triangles in the part. This is the default.

  • ‘area’: sort according to decreasing surface area of the part.

Returns#

int array

An int array specifying for each triangle to which part it belongs. Values are in the range 0..nparts.

Notes#

Beware that the existence of degenerate elements may cause unexpected results. If unsure, use the remove_degenerate() method first to remove those elements.

Examples#

>>> coords = Coords([[0.0, 0.0, 0.0],
...                  [1.0, 0.0, 0.0],
...                  [0.0, 1.0, 0.0],
...                  [0.0, 0.0, 2.0]])
>>> elems = [[0,1,2], [0,2,3]]
>>> M = Mesh(coords,elems,eltype='tri3')
>>> print(M.partition_by_angle())
[1 0]