gs.morphs.Mesh#
gs.morphs.Mesh 是 Genesis 项目中的一个类,用于处理网格变形。这个类提供了多种方法和属性,帮助用户对网格进行各种变形操作。
- class genesis.options.morphs.Mesh(*, pos: tuple = (0.0, 0.0, 0.0), euler: tuple | None = (0.0, 0.0, 0.0), quat: tuple | None = None, visualization: bool = True, collision: bool = True, requires_jac_and_IK: bool = False, file: Any = '', scale: float | tuple = 1.0, convexify: bool | None = None, recompute_inertia: bool = False, parse_glb_with_trimesh: bool = False, fixed: bool = False, group_by_material: bool = True, merge_submeshes_for_collision: bool = True, decimate: bool = True, decimate_face_num: int = 500, decompose_nonconvex: bool | None = None, coacd_options: CoacdOptions | None = None, order: int = 1, mindihedral: int = 10, minratio: float = 1.1, nobisect: bool = True, quality: bool = True, verbose: int = 0, force_retet: bool = False)[源代码]#
Morph loaded from a mesh file.
备注
In order to speed up simulation, the loaded mesh will first be decimated (simplified) to a target number of faces, followed by convexification (for collision mesh only). Such process can be disabled by setting decimate and convexify to False.
- 参数:
file (str) – The path to the file.
scale (float or tuple, optional) – The scaling factor for the size of the entity. If a float, it scales uniformly. If a 3-tuple, it scales along each axis. Defaults to 1.0. Note that 3-tuple scaling is only supported for gs.morphs.Mesh.
pos (tuple, shape (3,), optional) – The position of the entity in meters. Defaults to (0.0, 0.0, 0.0).
euler (tuple, shape (3,), optional) – The euler angle of the entity in degrees. This follows scipy’s extrinsic x-y-z rotation convention. Defaults to (0.0, 0.0, 0.0).
quat (tuple, shape (4,), optional) – The quaternion (w-x-y-z convention) of the entity. If specified, euler will be ignored. Defaults to None.
convexify (bool, optional) – Whether to convexify the entity. When convexify is True, all the meshes in the entity will be converted to a convex hull. If not given, it defaults to True for RigidEntity and False for other deformable entities.
decompose_nonconvex (bool, optional) – Whether to decompose meshes into convex components, if input mesh is nonconvex and convexify=False. We use coacd for this decomposition process. If not given, it defaults to True for RigidEntity and False for other deformable entities.
coacd_options (CoacdOptions, optional) – Options for configuring coacd convex decomposition. Needs to be a gs.options.CoacdOptions object.
visualization (bool, optional) – Whether the entity needs to be visualized. Set it to False if you need a invisible object only for collision purposes. Defaults to True. visualization and collision cannot both be False. This is only used for RigidEntity.
collision (bool, optional) – Whether the entity needs to be considered for collision checking. Defaults to True. visualization and collision cannot both be False. This is only used for RigidEntity.
requires_jac_and_IK (bool, optional) – Whether this morph, if created as RigidEntity, requires jacobian and inverse kinematics. Defaults to False. This is only used for RigidEntity.
parse_glb_with_trimesh (bool, optional) – Whether to use trimesh to load glb files. Defaults to False, in which case pygltflib will be used.
fixed (bool, optional) – Whether the baselink of the entity should be fixed. Defaults to False. This is only used for RigidEntity.
group_by_material (bool, optional) – Whether to group submeshes by their visual material type defined in the asset file. Defaults to True. This is only used for RigidEntity.
merge_submeshes_for_collision (bool, optional) – Whether to merge submeshes for collision. Defaults to True. This is only used for RigidEntity.
decimate (bool, optional) – Whether to decimate (simplify) the mesh. Defaults to True. This is only used for RigidEntity.
decimate_face_num (int, optional) – The number of faces to decimate to. Defaults to 500. This is only used for RigidEntity.
order (int, optional) – The order of the FEM mesh. Defaults to 1. This is only used for FEMEntity.
mindihedral (int, optional) – The minimum dihedral angle in degrees during tetraheralization. Defaults to 10. This is only used for Volumetric Entity that requires tetraheralization.
minratio (float, optional) – The minimum tetrahedron quality ratio during tetraheralization. Defaults to 1.1. This is only used for Volumetric Entity that requires tetraheralization.
nobisect (bool, optional) – Whether to disable bisection during tetraheralization. Defaults to True. This is only used for Volumetric Entity that requires tetraheralization.
quality (bool, optional) – Whether to improve quality during tetraheralization. Defaults to True. This is only used for Volumetric Entity that requires tetraheralization.
verbose (int, optional) – The verbosity level during tetraheralization. Defaults to 0. This is only used for Volumetric Entity that requires tetraheralization.
force_retet (bool, optional) – Whether to force re-tetraheralization. Defaults to False. This is only used for Volumetric Entity that requires tetraheralization.