an.stage.support#
Supports: what a body rests on, and how far it is from resting there (an#519, catalogue A1).
A support joint (an.ir.schema.JointSpec, type: support) says a
body’s contact points rest on a surface: ground (the shot’s floor line),
<body>@surface[@f] (a body’s supporting segment, the hold layer’s grammar)
or a world@x,y segment with end. This module is the pure measurement
under the support check (an.verify.support):
contacts_of(): the named points of an entity that touch what it stands on, by one fallback chain: the entity kind’s hook (an.genres.EntityKind.contacts: a character’s feet), else the descriptor’smetadata.contacts({name: [u, v]}, fractions of the root part’s drawing), else the rig’s declaredoriginwhen a part rests on it (an#601’s rule: where the rig stands, not where it is held), else the lowest point of its root parts’ ink:inkwhen a raster’s alpha hull was read,boxwhen only the corners of its box were (SVG art), which is measured for a declared support but never makes an entity be taken to stand.supports_at(): every declared support of a compiled shot, and every entity taken to stand on its floor, asSupportStaterecords per instant: each contact’s signed distance to the surface along its normal (an.stage.surface_line.lowest_on()’s sign: positive above, negative sunk), whether it is a limb’s (on a part that is not one of the body’s roots), where its foot on the surface lies along it (along, in the surface’s own frame) and how far that foot slid along it since the grid instant before while the contact was held there (theskatecheck’s measure, an#519 PR 2), with the references that do not resolve returned as(where, message).
A named point (cup@base, paul@foot_l) is resolved by the solve’s own
resolver (an.stage.solve.locate_point()), so a pin and a support
naming one contact name one point (an.stage.solve.contact_point()); a
<body>@surface is the hold layer’s segment
(an.stage.surface_line.body_surface()).
Tolerances are fractions of the entity’s height with a pixel floor
(support_tolerance()): a wide and a close-up agree, and a small prop is
not held to a gap below what a frame shows.
>>> support_tolerance(200.0), support_tolerance(30.0)
(4.0, 2.0)
Module Attributes
Where an entity's contacts come from, in the order the chain tries them. |
|
The descriptor's |
|
How far a contact may be off its surface, either way, as a fraction of the entity's height (4 px on a 200 px figure). |
|
the solver's own rejoin blend ( |
|
How fast a held contact's foot may move along its surface, in the surface's own frame, as a fraction of the entity's height PER SECOND (24 px/s on a 200 px figure: 1 px a frame at 24 fps, 0.4 px at 60). |
|
The least skate speed tolerance, in px per second (half a pixel a frame at 24 fps: a fraction of a small body's height is less). |
|
How far a held contact's foot may drift along its surface over one stance (from where it was planted, while it stays held), as a fraction of the entity's height (6 px on a 200 px figure): a slow skate under the speed tolerance still adds up to a foot that is not where it was put down. |
|
the support's own floor ( |
|
A step between two instants whose foot moves along the surface's normal by more than this fraction of how far it moves along the surface is a lift-off or a landing (a foot leaving the floor while still within the support tolerance of it), not a slide: it is not measured for skate. |
Functions
|
How far a contact of an entity |
|
How fast (px per second) a held contact of an entity |
|
How far (px) a held contact of an entity |
|
|
|
The contacts the chain names on a part of |
|
Every declared support of |
Classes
|
An entity's contacts and where the chain found them. |
|
One contact at one instant. |
|
One support (declared, or a stance taken as the shot opens) at one instant. |
- an.stage.support.CONTACTS_KEY: str = 'contacts'#
The descriptor’s
metadatakey that names a prop’s contacts.
- an.stage.support.CONTACT_SOURCES: tuple[str, ...] = ('hook', 'metadata', 'origin', 'ink', 'box')#
Where an entity’s contacts come from, in the order the chain tries them.
- class an.stage.support.ContactState(name, part, at, above, limb=False, along=0.0, slid=None)[source]#
Bases:
objectOne contact at one instant.
- along: float = 0.0#
where the foot of its normal falls along the surface from a point fixed in it, in the surface’s units (a body’s surface: its own units from the segment’s first end, so it neither moves nor flips with the body; the floor and a stage segment: stage px from the floor’s
(0, y)or the segment’sa).- Type:
Its foot parameter along the surface, in the surface’s own frame
- limb: bool = False#
its node is not the entity’s own nor one of its root parts (a leg hinged to the body, a hoof), so it moves relative to the body and can skate. A body’s own stance point (its
origin, the ink of its roots, a prop’sbase, a bone on a root part) cannot: a body that glides or is pushed slides on it by right.- Type:
Whether it is a limb’s
- slid: float | None = None#
How far (stage px, signed along the surface) its foot moved along the surface, in the surface’s own frame, since the grid’s previous instant (so a body carried by what it stands on does not move);
Noneunless it was held at both (its support joined, within the support tolerance of the surface) and the step was not a lift-off or a landing (SKATE_LIFT).
- class an.stage.support.Contacts(source, points, note='')[source]#
Bases:
objectAn entity’s contacts and where the chain found them.
>>> Contacts("origin", {"origin": ("", None)}).names ('origin',)
- an.stage.support.SKATE_DRIFT_FLOOR_PX: float = 2.0#
the support’s own floor (
SUPPORT_FLOOR_PX), below which two points are one.- Type:
The least drift tolerance, in px
- an.stage.support.SKATE_DRIFT_TOLERANCE: float = 0.03#
How far a held contact’s foot may drift along its surface over one stance (from where it was planted, while it stays held), as a fraction of the entity’s height (6 px on a 200 px figure): a slow skate under the speed tolerance still adds up to a foot that is not where it was put down.
- an.stage.support.SKATE_FLOOR_PX: float = 12.0#
The least skate speed tolerance, in px per second (half a pixel a frame at 24 fps: a fraction of a small body’s height is less).
- an.stage.support.SKATE_LIFT: float = 0.25#
A step between two instants whose foot moves along the surface’s normal by more than this fraction of how far it moves along the surface is a lift-off or a landing (a foot leaving the floor while still within the support tolerance of it), not a slide: it is not measured for skate.
- an.stage.support.SKATE_TOLERANCE: float = 0.12#
How fast a held contact’s foot may move along its surface, in the surface’s own frame, as a fraction of the entity’s height PER SECOND (24 px/s on a 200 px figure: 1 px a frame at 24 fps, 0.4 px at 60). A speed, so one slide gets one verdict at any frame rate or step rate.
- an.stage.support.SUPPORT_FLOOR_PX: float = 2.0#
the solver’s own rejoin blend (
an.kinematics.solver.DFLT_REJOIN_BLEND_PX), below which it calls two points joined; a small prop is not held tighter than a joint.- Type:
The least tolerance, in px
- an.stage.support.SUPPORT_TOLERANCE: float = 0.02#
How far a contact may be off its surface, either way, as a fraction of the entity’s height (4 px on a 200 px figure).
- class an.stage.support.SupportState(entity, joint, where, frame, t, surface, surface_ref, contacts, joined, height, source, named='', world_floor=False)[source]#
Bases:
objectOne support (declared, or a stance taken as the shot opens) at one instant.
>>> s = SupportState("cup", None, "entities", 0, 0.0, ((0.0, 0.0), (1.0, 0.0)), "ground", ... (ContactState("base", "cup", (0.0, -3.0), 3.0),), True, 30.0, "metadata") >>> s.lowest, s.inferred (3.0, True)
- contacts: tuple[ContactState, ...]#
The contacts measured (one past a bounded surface’s ends is not).
- height: float#
what its tolerance is a fraction of.
- Type:
The entity’s height as the shot opens (px)
- property lowest: float | None#
The least distance of a contact above the surface;
None, none measured.
- source: str#
Where its contacts came from (
CONTACT_SOURCES; a point named by bone, landmark or fraction ispoint).
- an.stage.support.contacts_of(entity, mall, *, rig=None, descriptor=None, doc=None)[source]#
entity’s contacts, by the chain: the kind’s hook,metadata.contacts, the rig’sorigin(when a root part’s painted bottom rests on it, read indoc), else the lowest ink of its root parts:inkwhendocshows a raster whose alpha hull was read, elsebox.>>> from types import SimpleNamespace as NS >>> contacts_of(NS(kind="prop", store=None, ref="x"), {}, descriptor={"origin": [0, 0]}) Contacts(source='origin', points={'origin': ('', None)}, note='') >>> contacts_of(NS(kind="prop", store=None, ref="x"), {}).source 'box'
- Return type:
- an.stage.support.contacts_on_parts(entity, desc, *, rig)[source]#
The contacts the chain names on a part of
entity’s rig (the hook’s, elsemetadata.contacts, a root-part fraction put on the first root): what the point resolver (an.stage.solve.locate_point()) names after a rig’s landmarks, so a joint, a verb or a support may namepaul@foot_las it namespaul@hand_l.>>> from types import SimpleNamespace as NS >>> contacts_on_parts(NS(kind="prop"), {"metadata": {"contacts": {"base": [0.5, 1]}}}, rig=NS(roots=("body",))) {'base': ('body', (0.5, 1.0))}
- an.stage.support.skate_drift_tolerance(height, *, tolerance=0.03, floor=2.0)[source]#
How far (px) a held contact of an entity
heightpx tall may drift along its surface over one stance:toleranceof its height, never underfloor.>>> skate_drift_tolerance(200.0), skate_drift_tolerance(40.0) (6.0, 2.0)
- Return type:
- an.stage.support.skate_tolerance(height, *, tolerance=0.12, floor=12.0)[source]#
How fast (px per second) a held contact of an entity
heightpx tall may slide along its surface:toleranceof its height per second, never underfloor.>>> skate_tolerance(200.0), skate_tolerance(40.0) (24.0, 12.0)
- Return type:
- an.stage.support.support_tolerance(height, *, tolerance=0.02, floor=2.0)[source]#
How far a contact of an entity
heightpx tall may be off its surface:toleranceof its height, never underfloorpx.>>> support_tolerance(500.0), support_tolerance(500.0, tolerance=0.05, floor=30.0) (10.0, 30.0)
- Return type:
- an.stage.support.supports_at(doc, shot, mall, *, times=None, inferred=True, rest_only=True, tolerance=0.02, floor=2.0, lift=0.25)[source]#
Every declared support of
shotin its compiled documentdocat every instant oftimes(default: the solve’s frame grid,an.stage.solve.frame_times()), joined or not; and, withinferred, every entity taken to stand on the shot’s floor (solve: {ground: y}) as it opens: its lowest contact withinsupport_tolerance()(toleranceof its height,floorpx at least) of the floor then, measured at that instant and its rest instants (rest_only, thesupportcheck’s rule) or at every instant (theskatecheck’s, which judges a stance while it moves).A contact is held at an instant its support is joined and it is within that tolerance of the surface; its
slidis how far (stage px) its foot parameter along the surface (along, in the surface’s own frame) changed since the grid’s previous instant, when it was held at both and its motion along the surface’s normal was at mostliftof that (more is a foot leaving or meeting the surface). An entity is not measured at an instant it is not seen (its alpha at mostan.base.UNSEEN_ALPHA: a member the world hides outside its on-screen window, a fade’s end), the rule thesoliditycheck applies, so a slide is never measured across one. Returns the states and(where, message)for each reference that does not resolve (no state is made for it).