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

Function form_mesh

python/pymesh/meshio.py:62–94  ·  view source on GitHub ↗

Convert raw mesh data into a Mesh object. Args: vertices (`numpy.ndarray`): ndarray of floats with size (num_vertices, dim). faces: ndarray of ints with size (num_faces, vertex_per_face). voxels: optional ndarray of ints with size (num_voxels, ve

(vertices, faces, voxels=None)

Source from the content-addressed store, hash-verified

60 return voxels
61
62def form_mesh(vertices, faces, voxels=None):
63 """ Convert raw mesh data into a Mesh object.
64
65 Args:
66 vertices (`numpy.ndarray`): ndarray of floats with size (num_vertices,
67 dim).
68 faces: ndarray of ints with size (num_faces, vertex_per_face).
69 voxels: optional ndarray of ints with size (num_voxels,
70 vertex_per_voxel). Use ``None`` for forming surface meshes.
71
72 Returns:
73 A :py:class:`Mesh` object formed by the inputs.
74
75 Example:
76
77 >>> vertices = np.array([
78 ... [0.0, 0.0],
79 ... [1.0, 0.0],
80 ... [1.0, 1.0],
81 ... [0.0, 1.0],
82 ... ])
83 >>> faces = np.array([
84 ... [0, 1, 2],
85 ... [0, 2, 3],
86 ... ])
87 >>> mesh = pymesh.form_mesh(vertices, faces)
88 """
89 voxels = deduce_voxel_type(faces, voxels)
90 faces = deduce_face_type(faces, voxels)
91
92 factory = PyMesh.MeshFactory()
93 factory.load_matrices(vertices, faces, voxels)
94 return Mesh(factory.create())
95
96def save_mesh_raw(filename, vertices, faces, voxels=None, **setting):
97 """ Save raw mesh to file.

Callers 15

test_vertex_to_voxelMethod · 0.90
test_face_to_voxelMethod · 0.90
test_2D_meshesMethod · 0.90
test_squareMethod · 0.90
test_square_2Method · 0.90
test_face_edge_touchMethod · 0.90
test_rotate_120Method · 0.90

Calls 5

createMethod · 0.95
MeshClass · 0.90
deduce_voxel_typeFunction · 0.85
deduce_face_typeFunction · 0.85
MeshFactoryMethod · 0.45

Tested by 15

test_vertex_to_voxelMethod · 0.72
test_face_to_voxelMethod · 0.72
test_2D_meshesMethod · 0.72
test_squareMethod · 0.72
test_square_2Method · 0.72
test_face_edge_touchMethod · 0.72
test_rotate_120Method · 0.72