cellcomplex.property_topomesh.analysis.compute_topomesh_property

cellcomplex.property_topomesh.analysis.compute_topomesh_property(topomesh, property_name, degree=0, positions=None, normal_method='density', object_positions=None, object_radius=10.0, verbose=False)[source]

Compute a property over the elements of a PropertyTopomesh.

The function computes and fills a property of a PropertyTopomesh passed as argument. The given property is computed for all elements of the specified degree and stored as a dictionary in the PropertyTopomesh structure.

Parameters
  • topomesh (cellcomplex.property_topomesh.PropertyTopomesh) – The structure on which to compute the property.

  • property_name (str) –

    The name of the property to compute, among the following ones:
    • barycenter (degree : [0, 1, 2, 3])

    • vertices (degree : [0, 1, 2, 3])

    • triangles (degree : [0, 1, 2, 3])

    • cells (degree : [0, 1, 2, 3])

    • length (degree : [1])

    • area (degree : [2])

    • volume (degree : [3])

    • normal (degree : [0, 2])

    • skewness (degree : [2])

    • roughness (degree : [0])

    • vertex_neighbors (degree : [2])

  • degree (int) – The degree of the elements on which to compute the property.

  • positions (dict) – A position dictionary to use if the property (‘barycenter’,0) is empty.

  • normal_method (str) –

    The method used to re-orient the face normals (default is density)
    • barycenter: oriented using the direction of the mesh center

    • density: oriented using the gradient of object density

    • orientation: consistently oriented using topological propagation

  • object_positions (dict) –

    The position of the object(s) represented by the mesh.
    • used only for property (‘normal’,2)

  • object_radius (float) –

    The radius of the object(s) represented by the mesh.
    • used only for property (‘normal’,2)

  • verbose (bool) – Whether to display or not information on computed properties.

Returns

Return type

None

Note

The PropertyTopomesh passed as argument is updated.

Example

>>> from cellcomplex.property_topomesh.example_topomesh import square_topomesh
>>> from cellcomplex.property_topomesh.analysis import compute_topomesh_property
>>> topomesh = square_topomesh(side_length=1)
>>> compute_topomesh_property(topomesh,'length',1)
>>> print topomesh.wisp_property('length',1)
{0: 1.0, 1: 1.0, 2: 1.41421356237, 3: 1.0, 4: 1.0}