网格 (Mesh)#
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.
- tetrahedralize(order, mindihedral, minratio, nobisect, quality, verbose)[源代码]#
Tetrahedralize the mesh.
- clear_visuals()[源代码]#
Clear the mesh’s visual attributes by resetting the surface to gs.surfaces.Default().
- 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.
- 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.