Mesh utilities#
The genesis.utils.mesh module provides helpers for loading meshes, generating primitive geometry, tetrahedralizing solids, and converting colors. They operate on trimesh meshes and NumPy arrays.
Loading and decomposition#
- genesis.utils.mesh.merge_submeshes(verts_list, faces_list)[source]#
Concatenate sub-meshes into a single mesh, welding vertices that share a position.
Welding covers both duplicated vertices within a sub-mesh (e.g. texture-seam splits) and vertices shared across sub-meshes, so that downstream consumers (e.g. tetrahedralization) see one connected surface.
- Parameters:
verts_list (list of np.ndarray) – Per-sub-mesh vertex arrays with shape (n_verts, 3).
faces_list (list of np.ndarray) – Per-sub-mesh face arrays with shape (n_faces, 3), indexing into the matching vertex array.
- Returns:
verts (np.ndarray) – Welded vertices, ordered by first occurrence in the concatenated input.
faces (np.ndarray) – Concatenated faces, re-indexed against the welded vertices.
verts_maps (list of np.ndarray) – For each sub-mesh, the map from its local vertex indices to indices into the welded vertices.
Primitive geometry#
- genesis.utils.mesh.create_cylinder(radius, height, sections=None, color=(1.0, 1.0, 1.0, 1.0))[source]#
- genesis.utils.mesh.create_box(extents=None, color=(1.0, 1.0, 1.0, 1.0), bounds=None, wireframe=False, wireframe_radius=0.002)[source]#
- genesis.utils.mesh.create_plane(normal=(0.0, 0.0, 1.0), plane_size=(1000.0, 1000.0), tile_size=(1, 1), color_or_texture='textures/checker.png', double_sided=False)[source]#
- genesis.utils.mesh.create_arrow(length=1.0, radius=0.02, l_ratio=0.25, r_ratio=1.5, body_color=(1.0, 1.0, 1.0, 1.0), head_color=(1.0, 1.0, 1.0, 1.0), sections=12)[source]#
- genesis.utils.mesh.create_line(start, end, radius=0.002, color=(1.0, 1.0, 1.0, 1.0), sections=12)[source]#
Tetrahedralization#
Color conversion#
Mesh info#
See also#
Geometry utilities: geometry transforms.
File I/O utilities: loading meshes through file-based morphs.