AutoMovie API
    Preparing search index...

    Class Archetype<Id, Dimension, Physical>

    What a producer returns: a model of one thing people hold, use, sit on, ride or fight with, with typed access to what a person's act reads from it.

    An archetype is an IAutoMovieModel: its own enumerable members are exactly a rigid generated model's (id, name, origin, parts, skeleton, body, affordances, materials, asset), so it goes wherever a model goes, serialises as one, and two archetypes from the same parameters and seed serialise to the same text. Everything else is reached through accessors that a copy or a serialisation leaves behind:

    • affordance(id) and site(id, u, v) give a contact and a place on it, with id checked against the producer's closed id type at compile time and refused at run time with the ids that exist;
    • articulate(state) gives the archetype with its articulations at the stated travels, parts and carried affordances moved with them, followers set by their leaders and spans laid again between their ends; travel(id) gives any articulation's travel, a follower's included, and span(id) a span's ends and slack. The travels live on the instance only: a serialised posed archetype is a picture of that pose and carries no state, so articulate from the archetype a producer returned, never from a copy read back;
    • dimensions gives each free dimension and provenance its source. Physical models carry mass, centre and inertia in properties. For visual models both properties and body are null.
    • shapes() gives colliders for a hand to close on, and placed(id, placement) a contact's frame in the world;
    • surface(part) gives what a part's surface is made of and friction(part, against) its measured friction against another material, while body carries the static and kinetic friction of what the model rests on against its ground (ArchetypeFriction). Lengths are metres, masses kilograms and angles degrees. The model's space has +Y up and +Z to the front of a thing that has one; an archetype that stands on the floor has its origin on the floor.

    Type Parameters

    • Id extends string = string

      The archetype's affordance ids, a closed union the producer declares.

    • Dimension extends string = string

      The archetype's free dimensions, a closed union the producer declares.

    • Physical extends IProperties | null = IProperties

      Mass properties or null for a visual-only model.

    Hierarchy (View Summary)

    Implements

    Index
    affordances: IAutoMovieAffordance[]

    The contacts at the current articulation state.

    asset: null

    Always null: no binary payload backs an archetype.

    body: Physical extends null ? null : IAutoMovieBody

    Rest mass, centre and contact coefficients, or null for a visual-only model.

    id: string

    Model id, unique in a scene; the producer's id parameter or its own name.

    materials: IAutoMovieMaterial[]

    The few flat materials the parts cite.

    name: string | null

    Readable name of the thing, such as dining chair.

    origin: "generated" = ...

    Always generated: the geometry is fully described by parts.

    The actual primitive or convex-cell parts at the current articulation state.

    skeleton: null

    Always null: an archetype is a rigid or articulated object, never a humanoid rig.

    • get dimensions(): Readonly<Partial<Record<Dimension, number>>>

      The value of each free dimension this variant has, in the unit of its band: drawn from the seed, or fixed by a parameter. A dimension the variant lacks, as a stool lacks a back height, is absent.

      Returns Readonly<Partial<Record<Dimension, number>>>

    • One of the archetype's contacts, at the current articulation state.

      Parameters

      • id: Id

        The affordance id.

      Returns IAutoMovieAffordance

      The affordance, its frame in the model's space.

      When the archetype declares no such affordance, listing the ids it declares; a producer's variant may lack an id its type allows, as a glass lacks a mug's handle.

    • This archetype with its articulations at stated travels.

      Parameters

      • state: Partial<Record<Id, number>>

        One input per coupled degree of freedom, by its leader or an explicitly reversible follower, degrees for turning kinds and metres for translating kinds. An independent articulation not listed is at rest, whatever this archetype's own state.

      Returns Archetype<Id, Dimension, Physical>

      A new archetype; this one is unchanged.

      For an unknown articulation, a travel outside its range or its reversible coupling's image, an unmarked follower, or duplicate inputs for one coupled degree of freedom.

    • The friction between a part and a material, as a measured pair gives it.

      Parameters

      • part: string

        The part's id.

      • against: Material

        The other surface's material: a hand's, a floor's, another part's.

      Returns IFriction

      The pair's static and kinetic coefficients and their source.

      When the part declares no surface, listing the parts that do, or no source measured the pair.

    • A contact site on an affordance, by coordinates over its extent as ArchetypeSite defines them.

      Parameters

      • id: Id

        The affordance id.

      • Optionalu: number

        The first coordinate, 0 to 1; the middle when absent.

      • Optionalv: number

        The second coordinate, 0 to 1; the middle when absent.

      Returns IAutoMovieTransform

      The site's frame in the model's space.

      For an unknown id, or a coordinate outside 0 to 1.

    • An articulation's travel at this state: the travel set for a leader, 0 for one not set, and the travel its leader gives a follower.

      Parameters

      • id: Id

        The articulation's id.

      Returns number

      The travel, degrees for the turning kinds and metres for the others.

      When the id is no articulation of the archetype, listing those it has.