Skip to content

trusty.constraints

Constraints: pins.

PairContact

Bases: Enum

Exclude class-attribute instance-attribute

Exclude = 0

Keep class-attribute instance-attribute

Keep = 1

add_pin

add_pin(
    world: World,
    body: int,
    nodes: Sequence[int] | None = None,
    *,
    faces: Sequence[int] | None = None,
    to: int | None = None,
    contact: PairContact | None = None,
    targets: ndarray[float64, (N, 3)] | None = None,
    stiffness: float | None = None,
    plane: Sequence[float] | None = None,
    line: Sequence[float] | None = None,
) -> int

Pin points of body: nodes, a list of node indices, or faces, a list of boundary-triangle indices (rows of F in V, F = trusty.surface.mesh(world, body)) whose vertices are pinned, ascending, each weighted by the rest area around it. With neither to nor targets the points are held where they are when the world is first built; to=body carries each with that body (a solid or affine body at any distance outside it, a shell or rod on its midsurface or centerline), and bars the two bodies from colliding unless contact=PairContact.Keep; targets=X (#points, 3, rows in the order of the points) pulls them toward X, rewritable with set_pin_targets. The pin is exact unless stiffness makes it compliant, an elastic energy of zero rest length: N/m for each node of nodes, N/m^3 (per unit of rest area) for faces. plane=n holds each point on the plane through its target with normal n (a roller: pinned along n, free across it); line=a holds it on the line through its target along a (a slider: free along a); a target then only places the plane or line, and its component along the free directions is ignored. Without either every direction is pinned, as it is for a pin to a body. Returns the pin's entity.

set_pin_targets

set_pin_targets(
    world: World,
    pin: int,
    targets: ndarray[float64, (N, 3)],
) -> None

Replace the targets of a pin created with targets=, shape (#points, 3). Takes effect on the next step.

reaction_forces

reaction_forces(
    world: World, pin: int
) -> ndarray[float64, (N, 3)]

Per-point force (N) of a compliant pin to targets or in place from the last accepted step, (#points, 3), along the directions the pin holds. Zero before the first step.