AutoMovie API
    Preparing search index...

    Function distalEndSwivelNearest

    • The swivel nearest a desired one at which a chain whose mid segment twists distally (an arm) can take a requested end rotation: outside the arcs its end joint's box refuses (distalEndSwivelArcs) and where the twist the rotation leaves the mid segment lies inside its range (distalTwistSwivelRange).

      The admissible swivels are a union of intervals whose ends are the refused arcs' ends and the twist range's breakpoints, so the admissible swivel nearest the desired one is the desired one itself or one of those ends: each is tested, a breakpoint a step of APART either side of itself since the admission changes there, and the nearest admitted is returned (the admissible swivel nearest the desired one, Tolani, Goswami and Badler 2000, section 3.2.4). When none is admitted (no swivel lets the joints take the rotation exactly, or the twist analysis is not given) the result is the swivel outside the refused arcs nearest the desired one, the candidate the box alone gives. The caller verifies the returned swivel by its own score.

      Parameters

      • arcs: readonly IAutoMovieSwivelArcs.IArc[] | "all"

        The swivels the end joint's box refuses, merged (swivelArcs.union), or every swivel.

      • range: distalTwistSwivelRange.IRange | null

        The twist range's breakpoints and admission; null when that analysis does not apply.

      • desired: number

        The desired swivel, degrees.

      Returns number | null

      The swivel, degrees in any turn; null when the box refuses every swivel.