AutoMovie API
    Preparing search index...

    Function solveDistalTwist

    • The twist a distally twisting mid bone (a forearm, which pronates and supinates about its own length beyond the elbow's hinge) takes so its effector (a wrist, which flexes and deviates but cannot twist) can reach a requested rotation.

      The effector reads its rotation as clinical angles in its own Euler convention, and the share it cannot take is that convention's twist. The mid bone's twist composes last in its own articulation, A = Abd Flex T(u, r), so the effector's local rotation is rest^-1 T(u, -r) K with K fixed by the pose above and the request. Explicit flexion-abduction-twist likewise keeps the lower twist last and selects the corresponding matrix entries when the effector uses that chart. The effector's rig twist is atan2(P, Q) of two components of that rotation applied to its flexion (and, for a distal effector, abduction) axis (decomposeJointRotationOnBasis), and each component of a vector turned about u by -r is alpha + beta cos r + gamma sin r. Asking the effector's twist to stand at its clinical zero is therefore one equation A + B cos r + C sin r = 0, solved in closed form: at most two forearm twists, the circle the hand turns on as the forearm twists crossing the rotations the wrist's two angles make. Of those inside the forearm's range, the range's two ends and the start, the one whose effector, clamped to its own range, shows the request most nearly is taken, and between equals the one nearest the start: the current twist plus the swing-twist share (swingTwist) of the change from the effector's current rotation to the requested one. So only the residual beyond the current pose moves, a request near the current hand rotation prefers a nearby forearm twist. The bounded candidate law is retained; it does not globally minimize over both joints. Every candidate is ranked through the same effector projection that final orientation uses.

      Parameters

      • props: solveDistalTwist.IProps

        The mid joint's and the effector's current clinical angles; above, the world rotation the mid joint's articulation composes after (its parent's world rotation and its rest); the mid and effector bases (normalized) and rest frames; the fixed lower-to-effector rotation, including unchanged intermediate bones and the effector rest; the requested effector world rotation; the skeleton whose ranges clamp; and, from a caller that solves many candidates, the two joints' clamps resolved once on that skeleton (clampJointToSkeleton.of) and optional shared effector projection prepared for those same axes, frame, domain and clamp. An optional effectorRestInverse must be Quaternion.inverse of that exact fixed rest frame; otherwise this solve computes it once for all trials. Optional articulation readers return this joint's raw composition, its rig-zero-twist composition and the actual held effector world-relative composition. They run at the original first-use sites; callers may share only unchanged joint/basis/frame inputs, never target-dependent answers. An optional composeLower belongs to this request on that same admitted lower basis/frame; it shares pure axis factors with the caller's immediate lower recomposition while still validating each joint and returning its fresh outer product; a private matching inner pair may also be shared. Optional preparedEffector borrows the fixed effector-frame readings from prepare under exactly the same rest, admitted basis and clinical frame. readHeldInverse may share Quaternion.inverse of the actual held raw quaternion. Its raw reader and angle/frame admission still run first, and the inverse callback runs only at the original inverse-use site. The target, preceding frame and admitted inputs stay unchanged throughout this synchronous solve, including while its pure readers/clamps run.

      Returns IAutoMovieJointPose

      The mid joint with its twist solved, clamped to the rig's range.