AutoMovie API
    Preparing search index...

    Function fitHingedChainCandidate

    • The hinged chain's candidate: hingedArmArticulation's swivel sweep with each candidate decomposed through the prepared clinical domains, scored first by the rig's ROM overshoot plus the request's obstruction of the candidate's mid and end joints, and then by one continuous cost: the requested effector rotation's error in degrees (when one is requested), plus two degrees per unit of the mid joint's swing away from the bend hint's side of the root-to-target axis (1 - cos; without a hint, the side the posed hinge already bends toward, see posedHingeSwing), plus, when the request carries a referencePose (a grid-free reference such as the solution at a contact event, never the previous frame, so a pose stays a pure function of time), the degrees the root and mid joints turn away from it, with the clinical effort as a vanishing tie-break. The cost is continuous in the target, so the chosen swivel moves continuously as a target moves and jumps only where two separate minima tie exactly; the reference term then decides the tie toward the reference's side. The weights are provisional, as no source fixes them. Under this continuous cost the cold fit starts in closed form: without a requested rotation at the side term's peak, the pole of two-bone IK (hingedChainSide.peak), which alone answers when no reference or obstruction is asked; with one, at the swivel needing the least end-joint articulation (hingedRotationStart, or hingedTwistStart on a limb whose mid segment twists distally). It searches locally and keeps a legal result whose rotation is met; the full sweep runs otherwise and when the limb has no side. Before either, a requested rotation on a limb without distal twist whose end joint has one immobile axis (an ankle) is answered with no search: such a joint takes the rotation only where the rotation demanded of it reads that axis neutral, at most two swivels a bend branch in closed form (immobileAxisSwivels), and the best of them under the same score is the fit when it is legal and the rotation is met. A limb whose mid segment twists distally (an arm) offers one candidate the same way: the swivel nearest the hint's pole that its end joint's box (distalEndSwivelArcs) and its mid segment's twist range (distalTwistSwivelRange) both admit, an interval end in closed form (distalEndSwivelNearest); with a reference pose, the box's alone, since the reference's turn then ranks beside the hint. Where that candidate does not answer, the sweep is bounded from below by the least the end joint must miss the rotation by at each swivel (distalEndSwivelMiss) or, when greater, the least the mid segment's twist range must (distalTwistSwivelRange's miss), besides the hint's side, so a rotation no swivel lets the wrist take is fitted by scoring only the swivels near the least miss, with the full sweep's choice. One degree of joint turn from the reference counts as much as one degree of effector error (times the request's referenceWeight, 1 when omitted), so the reference's side is kept unless a turn buys at least as much accuracy; and the hint's side is worth 2 degrees per unit of 1 - cos (4 degrees for the opposite side), enough to decide between otherwise equal swivels while never outweighing a visible effector error. A request continuing a nearby fit (near) refines that fit's seed instead of sweeping, and the candidate carries the seed it was chosen at. A request whose bend is the place a completed elbow search chose (placed) searches locally from that place's pole and answers there when legal, sweeping only where it is not. A request with a strain ranks the swivels by task priority instead (Siciliano and Slotine 1991): legality, then the hand's rotation error, two errors in one bucket of the joints' tolerance (ROM_TOLERANCE) being one (a quantisation, so the ranking is transitive and its choice independent of the order candidates are met in; the rotation's certified miss bounds that first key, so swivels whose miss lies in a later bucket are not scored), then the turn from a referencePose when one is given (which keeps a stroke's side), else the strain, with no bend hint; the candidate carries the value it was chosen by, so a caller ranking keys by their fits reads one continuous value (Berge's maximum theorem) instead of a measure taken at another search's argmin. Under that ranking a candidate at a swivel where the closed form shows the rotation met (inside the end joint's box arcs, its mid segment's twist inside its range) is ranked in the first bucket without its error being measured; the chosen candidate's error is measured for the value, and a choice whose measured bucket differs from the one it was ranked by is searched again with every error measured. A continued fit tries the closed-form candidates lying by its seed before refining it (hingedSwivelNear), and a cold fit whose rotation's certified miss exceeds the tolerance at every swivel skips the pole start that could not be accepted.

      Parameters

      Returns IAutoMovieSolvedChainPlant | null

      The candidate, or null for a degenerate chain.