MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / convert_to_vertex_attribute

Function convert_to_vertex_attribute

python/pymesh/meshutils/attribute_utils.py:4–16  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

2import numpy as np
3
4def 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
18def convert_to_vertex_attribute_from_name(mesh, name):
19 """ Same as :py:func:`convert_to_vertex_attribute` except looking up

Callers 5

test_vertex_to_vertexMethod · 0.90
test_face_to_vertexMethod · 0.90
check_face_fieldMethod · 0.85
check_voxel_fieldMethod · 0.85

Calls 1

Tested by 4

test_vertex_to_vertexMethod · 0.72
test_face_to_vertexMethod · 0.72
check_face_fieldMethod · 0.68
check_voxel_fieldMethod · 0.68