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

Function convert_to_voxel_attribute

python/pymesh/meshutils/attribute_utils.py:44–56  ·  view source on GitHub ↗

Convert attribute ``attr`` from either per-vertex or per-face attribute into per-voxel attribute. Args: mesh (:py:class:`Mesh`): Input mesh. attr (``numpy.ndarray``): #voxel by k matrix of floats. Returns: Per-voxel attribute. The value at a voxel will be the a

(mesh, attr)

Source from the content-addressed store, hash-verified

42 return PyMesh.convert_to_face_attribute_from_name(mesh.raw_mesh, name)
43
44def convert_to_voxel_attribute(mesh, attr):
45 """ Convert attribute ``attr`` from either per-vertex or per-face attribute
46 into per-voxel attribute.
47
48 Args:
49 mesh (:py:class:`Mesh`): Input mesh.
50 attr (``numpy.ndarray``): #voxel by k matrix of floats.
51
52 Returns:
53 Per-voxel attribute. The value at a voxel will be the average of
54 the values at its neighboring vertices or faces.
55 """
56 return PyMesh.convert_to_voxel_attribute(mesh.raw_mesh, attr)
57
58def convert_to_voxel_attribute_from_name(mesh, name):
59 """ Same as :py:func:`convert_to_voxel_attribute` except looking up

Callers 5

test_vertex_to_voxelMethod · 0.90
test_face_to_voxelMethod · 0.90
check_vertex_fieldMethod · 0.85
check_face_fieldMethod · 0.85

Calls 1

Tested by 4

test_vertex_to_voxelMethod · 0.72
test_face_to_voxelMethod · 0.72
check_vertex_fieldMethod · 0.68
check_face_fieldMethod · 0.68