openalea.cellcomplex.property_topomesh.property_topomesh_analysis.compute_topomesh_property¶
-
openalea.cellcomplex.property_topomesh.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 (
openaela.mesh.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])
- degree (int) – The degree of the elements on which to compute the property.
- positions (dict, optional) – A position dictionary if the property (‘barycenter’,0) is empty.
- normal_method (str, optional) –
- 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, optional) –
- The position of the object(s) represented by the mesh.
- used only for property (‘normal’,2)
- object_radius (float, optional) –
- The radius of the object(s) represented by the mesh.
- used only for property (‘normal’,2)
- verbose (bool, optional) – Whether to display or not information on computed properties.
Returns: None
Note
The PropertyTopomesh passed as argument is updated.
Example
>>> from openalea.cellcomplex.property_topomesh.example_topomesh import square_topomesh >>> from openalea.cellcomplex.property_topomesh.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}
- topomesh (