The bone-local articulation of a resolved two-segment chain that lands its
end effector on target: the leg plant's solve.
Segment lengths and rest directions are measured from the chain's resolved
world positions. The upper segment is lifted off the root-to-target axis by
solveTwoBoneIK's lift, turning about the bend-plane normal: the
caller's bendNormal when given, otherwise axis × world-down so the mid
joint is displaced toward world-down, or axis × +Z when the axis is
vertical. The root's world change is lowered to bone-local as
restWorld⁻¹ · Δ · restWorld, and the mid joint aims the fore segment's
bone-local direction at the target. An unreachable target extends or folds
the chain toward it, so the effector stops on the reachable shell.
The mid rotation is a free swing, so it may carry abduction and twist; a
caller whose mid joint is a hinge passes the hinge axis as bendNormal to
keep the solve in its plane. The arm reach uses
hingedArmArticulation instead, which turns the elbow about its hinge
by construction. Which bones form the chain and how the deltas become
clinical angles stay with the caller.
Returns null for a degenerate chain: a segment shorter than 1e-6, or a
target within 1e-6 of the root.
Inputs remain unchanged during one call; explicit preparation additionally
keeps source frames fixed across targets and a target fixed across normals.
The bone-local articulation of a resolved two-segment chain that lands its end effector on
target: the leg plant's solve.Segment lengths and rest directions are measured from the chain's resolved world positions. The upper segment is lifted off the root-to-target axis by solveTwoBoneIK's
lift, turning about the bend-plane normal: the caller'sbendNormalwhen given, otherwiseaxis × world-downso the mid joint is displaced toward world-down, oraxis × +Zwhen the axis is vertical. The root's world change is lowered to bone-local asrestWorld⁻¹ · Δ · restWorld, and the mid joint aims the fore segment's bone-local direction at the target. An unreachable target extends or folds the chain toward it, so the effector stops on the reachable shell.The mid rotation is a free swing, so it may carry abduction and twist; a caller whose mid joint is a hinge passes the hinge axis as
bendNormalto keep the solve in its plane. The arm reach uses hingedArmArticulation instead, which turns the elbow about its hinge by construction. Which bones form the chain and how the deltas become clinical angles stay with the caller.Returns
nullfor a degenerate chain: a segment shorter than1e-6, or a target within1e-6of the root. Inputs remain unchanged during one call; explicit preparation additionally keeps source frames fixed across targets and a target fixed across normals.