trusty.contact¶
IPC contact configuration + builders.
ContactStencils
¶
ContactReport
¶
min_distance
property
¶
Smallest barrier clearance (m) over the active stencils: unsigned distance minus the pair's contact-offset sum. +inf when none is active.
ContactObserver
¶
BroadphaseKind
¶
Config
¶
MeshBvh
¶
closest_points
¶
closest_points(
P: ndarray[float64, (N, 3)],
) -> tuple[
ndarray[float64, (N,)],
ndarray[int32, (N,)],
ndarray[float64, (N, 3)],
]
Unsigned closest point on the mesh for each query row of P. Returns (sqrD, face, closest): squared distance, closest triangle index, and closest-point coordinates -- parallel over P, matching igl.point_mesh_squared_distance.
enable
¶
Run IPC contact on this world, with config as its settings. Contact is the one module nothing in the world activates -- every body publishes a boundary surface whether or not it should collide -- so this call is that intent. observer is an optional ContactObserver debug hook the IPC term reports to; keep a reference to a Python subclass alive for the simulation. Calling it again replaces the settings and the observer. Call before the first step().
add_plane
¶
add_plane(
world: World,
origin: ndarray[float64, (3,)],
normal: ndarray[float64, (3,)],
*,
friction_mu: float = 0.0,
) -> int
Add an infinite contact plane (a half-space through origin with outward normal) as a new world entity, which is returned. friction_mu is the plane's Coulomb coefficient (>= 0); 0 (the default) is frictionless. A contact uses the average of the plane's and the body's coefficients. Point-plane friction is CPU/Accelerate only. Requires trusty.contact.enable(world).
add_wall
¶
add_wall(
world: World,
name: str,
V: ndarray[float64, (N, M)],
F: ndarray[int32, (N, M)],
*,
friction_mu: float = 0.0,
) -> int
Add a static triangle-mesh collider (V (N, 3) vertices, F (M, 3) triangles) as a new world entity, which is returned. IPC contact and mpm.attach_wall_noslip both treat it as a fixed surface. friction_mu is the wall's Coulomb coefficient (>= 0); 0 (the default) is frictionless. Requires trusty.contact.enable(world), or MPM particles with mpm.attach_wall_noslip.
exclude_body_pair
¶
Bar all contact between body_a and body_b (whole-body, both directions). The exclusion dies with body_a. Call before the first step. Raises ValueError if body_a and body_b are the same body; use set_self_contact to stop a body colliding with itself.
set_self_contact
¶
Turn body's contact with itself on or off, for any body type. Every body self-collides by default except affine bodies, which start with it off. Contact with other bodies is unaffected. The setting lives on the body and dies with it. Call before the first step.
exclude_body_from_contact
¶
Exclude body from contact entirely (it collides with nothing, planes included): the IPC builder drops its surface, so the geometry never enters the broadphase. Cheaper than pairing it against every other body. Contact policy only -- the surface stays in the neutral surface registry, so surface loads on this body still work. Call before the first world.step().
set_body_friction
¶
Override the Coulomb friction coefficient for all contact touching body (a collision uses the average of the two bodies' coefficients), overwriting what add_*(..., friction_mu=) set. Applies to mesh-vs-mesh and point-plane contact; a plane carries its own (add_plane). Call before the first world.step(); a later call raises on the next step. Raises if a positive friction_mu is given for a body with no contact surface.