Convert attribute ``attr`` from either per-face or per-voxel attribute into per-vertex attribute. Args: mesh (:py:class:`Mesh`): Input mesh. attr (``numpy.ndarray``): #vertices by k matrix of floats. Returns: Per-vertex attribute. The value at a vertex will be
(mesh, attr)
| 2 | import numpy as np |
| 3 | |
| 4 | def convert_to_vertex_attribute(mesh, attr): |
| 5 | """ Convert attribute ``attr`` from either per-face or per-voxel attribute |
| 6 | into per-vertex attribute. |
| 7 | |
| 8 | Args: |
| 9 | mesh (:py:class:`Mesh`): Input mesh. |
| 10 | attr (``numpy.ndarray``): #vertices by k matrix of floats. |
| 11 | |
| 12 | Returns: |
| 13 | Per-vertex attribute. The value at a vertex will be the average of |
| 14 | the values at its neighboring faces or voxels. |
| 15 | """ |
| 16 | return PyMesh.convert_to_vertex_attribute(mesh.raw_mesh, attr) |
| 17 | |
| 18 | def convert_to_vertex_attribute_from_name(mesh, name): |
| 19 | """ Same as :py:func:`convert_to_vertex_attribute` except looking up |