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

Function submesh

python/pymesh/submesh.py:88–111  ·  view source on GitHub ↗

Extract a subset of the mesh elements and forming a new mesh. Args: mesh (:class:`Mesh`): The input mesh. element_indices (:class:`numpy.ndarray`): The indices of selected elements (faces/voxels). num_rings (`int`): The number of rings around the selected el

(mesh, element_indices, num_rings)

Source from the content-addressed store, hash-verified

86 return out_mesh
87
88def submesh(mesh, element_indices, num_rings):
89 """ Extract a subset of the mesh elements and forming a new mesh.
90
91 Args:
92 mesh (:class:`Mesh`): The input mesh.
93 element_indices (:class:`numpy.ndarray`): The indices of selected
94 elements (faces/voxels).
95 num_rings (`int`): The number of rings around the selected elements to
96 extract.
97
98 Returns:
99 A :class:`Mesh` object only containing the selected elements and their
100 local neighborhood up to `num_rings` rings. The output mesh contains the
101 following attributes:
102
103 * ori_face_index/ori_voxel_index: The original index of each element.
104 * ring: Index indicating which ring does each element belongs. The
105 selected elements belongs to the 0-ring.
106 """
107
108 if mesh.num_voxels == 0:
109 return extract_submesh_surface(mesh, element_indices, num_rings)
110 else:
111 return extract_submesh_volume(mesh, element_indices, num_rings)
112

Callers

nothing calls this directly

Calls 2

extract_submesh_surfaceFunction · 0.85
extract_submesh_volumeFunction · 0.85

Tested by

no test coverage detected