Mesh#

class genesis.engine.mesh.Mesh(mesh, surface=None, uvs=None, convexify=False, decimate=False, decimate_face_num=500, metadata={})[ソース]#

Genesis's own triangle mesh object. This is a wrapper of trimesh.Trimesh with some additional features and attributes. The internal trimesh object can be accessed via self.trimesh. We perform both convexification and decimation to preprocess the mesh for simulation if specified.

パラメータ:
  • surface (genesis.Surface) -- The mesh's surface object.

  • uvs (np.ndarray) -- The mesh's uv coordinates.

  • convexify (bool) -- Whether to convexify the mesh.

  • decimate (bool) -- Whether to decimate the mesh.

  • decimate_face_num (int) -- The target number of faces after decimation.

  • metadata (dict) -- The metadata of the mesh.

convexify()[ソース]#

Convexify the mesh.

decimate(target_face_num, convexify)[ソース]#

Decimate the mesh.

remesh(edge_len_abs=None, edge_len_ratio=0.01, fix=True)[ソース]#

Remesh for tetrahedralization.

tetrahedralize(order, mindihedral, minratio, nobisect, quality, verbose)[ソース]#

Tetrahedralize the mesh.

particlize(p_size=0.01, sampler='random')[ソース]#

Sample particles using the mesh volume.

clear_visuals()[ソース]#

Clear the mesh's visual attributes by resetting the surface to gs.surfaces.Default().

get_unique_edges()[ソース]#

Get the unique edges of the mesh.

copy()[ソース]#

Copy the mesh.

classmethod from_trimesh(mesh, scale=None, convexify=False, decimate=False, decimate_face_num=500, metadata={}, surface=None)[ソース]#

Create a genesis.Mesh from a trimesh.Trimesh object.

classmethod from_attrs(verts, faces, normals=None, surface=None, uvs=None, scale=None)[ソース]#

Create a genesis.Mesh from mesh attribtues including vertices, faces, and normals.

classmethod from_morph_surface(morph, surface=None)[ソース]#

Create a genesis.Mesh from morph and surface options. If the morph is a Mesh morph (morphs.Mesh), it could contain multiple submeshes, so we return a list.

set_color(color)[ソース]#

Set the mesh's color.

update_trimesh_visual()[ソース]#

Update the trimesh obj's visual attributes using its surface and uvs.

apply_transform(T)[ソース]#

Apply a 4x4 transformation matrix to the mesh.

show()[ソース]#

Visualize the mesh using trimesh's built-in viewer.

property uid#

Return the mesh's uid.

property trimesh#

Return the mesh's trimesh object.

property is_convex#

Whether the mesh is convex.

property metadata#

Metadata of the mesh.

property verts#

Vertices of the mesh.

property faces#

Faces of the mesh.

property normals#

Normals of the mesh.

property surface#

Surface of the mesh.

property uvs#

UVs of the mesh.

property area#

Surface area of the mesh.

property volume#

Volume of the mesh.