RigidGeom(刚体几何体)#

gs.RigidGeom 是 Genesis 项目中的一个类,表示刚体的几何结构。它是构建 RigidEntity 用于碰撞检测的基本单元,通常由单个网格构造。可以通过 link.geoms 访问。

class genesis.engine.entities.rigid_entity.rigid_geom.RigidGeom(link, idx, cell_start, vert_start, face_start, edge_start, mesh, type, friction, sol_params, init_pos, init_quat, needs_coup, center_init=None, data=None)[源代码]#

基类:RBC

A RigidGeom is the basic building block of a RigidEntity for collision checking. It is usually constructed from a single mesh. This can be accessed via link.geoms.

get_trimesh()[源代码]#

Get the geom’s trimesh object.

get_sdf_trimesh(color=[1.0, 1.0, 0.6, 1.0])[源代码]#

Reconstruct trimesh object from sdf.

visualize_sdf(pos=None, T=None, color=(1.0, 1.0, 0.3, 1.0), show_axis=False, axis_color=(1.0, 0.0, 0.0, 1.0), axis_length=0.3, show_boundary=False, boundary_color=(0.0, 1.0, 0.0, 0.2))[源代码]#

Visualizes the signed distance field (SDF) of the rigid geometry in the viewer.

sdf_grad_world(pos_world, recompute=False)[源代码]#

sdf grad wrt world frame coordinate.

sdf_grad_mesh(pos_mesh, recompute=False)[源代码]#

sdf grad wrt mesh frame coordinate.

sdf_grad_sdf(pos_sdf)[源代码]#

sdf grad wrt sdf frame coordinate.

sdf_world(pos_world, recompute=False)[源代码]#

sdf value from world coordinate

sdf_mesh(pos_mesh, recompute=False)[源代码]#

sdf value from mesh coordinate

sdf_sdf(pos_sdf)[源代码]#

sdf value wrt sdf frame coordinate. Note that the stored sdf magnitude is already w.r.t world frame.

set_friction(friction)[源代码]#

Set the friction coefficient of the geom.

get_pos()[源代码]#

Get the position of the geom in world frame.

get_quat()[源代码]#

Get the quaternion of the geom in world frame.

get_verts()[源代码]#

Get the vertices of the geom in world frame.

get_AABB()[源代码]#

Get the axis-aligned bounding box (AABB) of the geom in world frame.

property uid#

Get the unique ID of the geom.

property idx#

Get the global index of the geom in RigidSolver.

property type#

Get the type of the geom.

property friction#

Get the friction coefficient of the geom.

property sol_params#

Get the solver parameters of the geom.

property data#

Get the additional data of the geom.

property metadata#

Get the metadata of the geom.

Get the link that the geom belongs to.

property entity#

Get the entity that the geom belongs to.

property solver#

Get the solver that the geom belongs to.s

property is_convex#

Get whether the geom is convex.

property mesh#
property needs_coup#

Get whether the geom needs coupling with other non-rigid entities.

property coup_softness#

Get the softness coefficient of the geom for coupling.

property coup_friction#

Get the friction coefficient of the geom for coupling.

property coup_restitution#

Get the restitution coefficient of the geom for coupling.

property init_pos#

Get the initial position of the geom.

property init_quat#

Get the initial quaternion of the geom.

property init_verts#

Get the initial vertices of the geom.

property init_faces#

Get the initial faces of the geom.

property init_edges#

Get the initial edges of the geom.

property init_normals#

Get the initial normals of the geom.

property init_center_pos#

Get the initial center position of the geom.

property uvs#

Get the UV coordinates of the geom.

property surface#

Get the surface object of the geom.

property gsd_path#

Get the path to the preprocessed .gsd file.

property sdf_res#

Get the resolution of the geom’s signed distance field (SDF).

property sdf_val#

Get the signed distance field (SDF) of the geom.

property sdf_val_flattened#

Get the flattened signed distance field (SDF) of the geom.

property sdf_grad#

Get the gradient of the geom’s signed distance field (SDF).

property sdf_grad_flattened#

Get the flattened gradient of the geom’s signed distance field (SDF).

property sdf_max#

Get the maximum value of the geom’s signed distance field (SDF).

property sdf_cell_size#

Get the cell size of the geom’s signed distance field (SDF).

property sdf_grad_delta#

Get the delta value for computing the gradient of the geom’s signed distance field (SDF).

property sdf_closest_vert#

Get the closest vertex of each cell of the geom’s signed distance field (SDF).

property sdf_closest_vert_flattened#

Get the flattened closest vertex of each cell of the geom’s signed distance field (SDF).

property T_mesh_to_sdf#

Get the transformation matrix of the geom’s mesh frame w.r.t its signed distance field (SDF) frame.

property n_cells#

Number of cells in the geom’s signed distance field (SDF).

property n_verts#

Number of vertices of the geom.

property n_faces#

Number of faces of the geom.

property n_edges#

Number of edges of the geom.

property cell_start#

Get the starting index of the cells of the signed distance field (SDF) in the rigid solver.

property vert_start#

Get the starting index of the geom’s vertices in the rigid solver.

property face_start#

Get the starting index of the geom’s faces in the rigid solver.

property edge_start#

Get the starting index of the geom’s edges in the rigid solver.

property cell_end#

Get the ending index of the cells of the signed distance field (SDF) in the rigid solver.

property vert_end#

Get the ending index of the geom’s vertices in the rigid solver.

property face_end#

Get the ending index of the geom’s faces in the rigid solver.

property edge_end#

Get the ending index of the geom’s edges in the rigid solver.

property is_built#

Whether the rigid entity the geom belongs to is built.