an.kinematics.joints#
Joints: declared relations between two bodies, or a body and the world.
Every joint names its points as Points and
carries joined (the caller’s time dimension: an unjoined joint is kept in
the list, so its index is stable, and simply not enforced) and compliance
(0 is rigid; a positive value is a softness in units of distance per unit of
force, which XPBD keeps independent of the iteration count).
Pin: two points coincide; the bodies turn freely about them.Hinge: a pin plus a range for the relative angle, about the relative angle the bodies have on the solve’s input (or the first frame of a run), or an explicitrest.Weld: a pin plus a fixed relative angle.Distance: the two points keep a length:equal(a rod),at_most(a rope or string: slack is free),at_least(a spacer).Slide: a point stays on a segment of another body (a groove).Contact: a point stays on the free side of a segment, or on it (a foot on the ground, a lamp on a table); one-sided, and only over the segment’s own extent, so a body slides off an edge.
A segment’s free side: with the segment running from start to end,
the free side is the one a y-down screen shows ABOVE a left-to-right
segment (normal (ty, -tx)).
>>> Distance(Point("a", 0.5, 0.5), Point("b", 0.5, 0.5), length=10.0).mode
'equal'
Module Attributes
The ways a |
|
Every joint kind, in the order the module documents them. |
Classes
|
|
|
The two points keep |
|
A driver that is not a target: a constant |
|
A pin with a range for the angle of |
|
Two points coincide; free rotation about them. |
|
|
|
A pin plus a fixed relative angle ( |
- class an.kinematics.joints.Contact(point, start, end, compliance=0.0, joined=True)[source]#
Bases:
objectpointstays on the free side of the segmentstart–end, or on it; nothing holds it there (it may lift off), and nothing holds it beyond the segment’s ends (it may fall off an edge).>>> Contact(Point("lamp", 0.5, 1.0), Point("table", 0.0, 0.0), Point("table", 1.0, 0.0)).joined True
- class an.kinematics.joints.Distance(a, b, length, mode='equal', compliance=0.0, joined=True)[source]#
Bases:
objectThe two points keep
lengthapart: exactly, at most, or at least.>>> Distance(Point("hand", 0.5, 0.5), Point("world", 0.0, -200.0), length=150.0, mode="at_most").mode 'at_most'
- an.kinematics.joints.DistanceMode#
The ways a
Distancejoint may hold its length.alias of
Literal[‘equal’, ‘at_most’, ‘at_least’]
- class an.kinematics.joints.Force(point, vector=None, toward=None, strength=1.0)[source]#
Bases:
objectA driver that is not a target: a constant
vector(force per unit mass, applied atpoint, so an off-centre push also turns the body), or a pull ofpointtowarda position withstrength(a compliant zero-length rope:compliance = 1 / strength), or both.>>> Force(Point("kite", 0.5, 0.0), vector=(30.0, 0.0)).toward is None True
- class an.kinematics.joints.Hinge(a, b, limits=None, rest=None, compliance=0.0, joined=True)[source]#
Bases:
objectA pin with a range for the angle of
b’s body relative toa’s.limitsis(lo, hi)in radians aboutrest, within[-pi, pi];restis the relative angle (b.rotation - a.rotation) the range is measured from, taken from the bodies’ poses at the start of the solve whenNone. With nolimitsit is a pin.>>> Hinge(Point("fore", 0.0, 0.5), Point("upper", 1.0, 0.5), limits=(-2.6, 0.0)).limits (-2.6, 0.0)
- an.kinematics.joints.Joint = an.kinematics.joints.Pin | an.kinematics.joints.Hinge | an.kinematics.joints.Weld | an.kinematics.joints.Distance | an.kinematics.joints.Slide | an.kinematics.joints.Contact#
Every joint kind, in the order the module documents them.
- class an.kinematics.joints.Pin(a, b, compliance=0.0, joined=True)[source]#
Bases:
objectTwo points coincide; free rotation about them.
>>> Pin(Point("arm", 0.0, 0.5), Point("torso", 1.0, 0.2)).joined True