import type { Object3D } from "three"; import { Vector3 } from "three"; /** * Analytical two-bone IK solver operating in world space. * * Chain: root → middle → end. The pole controls middle-joint bend direction. * * Writes local quaternions to `root` and `middle` bones. * Does not modify the `end` bone. * * Call `solve()` after AnimationMixer update each frame. */ export declare class TwoBoneIK { /** First bone in the chain (e.g. upper leg, upper arm). */ readonly root: Object3D; /** Second bone in the chain (e.g. lower leg, forearm). */ readonly middle: Object3D; /** Terminal bone (e.g. foot, hand). Not rotated by the solver. */ readonly end: Object3D; /** Controls the bend direction of the middle joint. */ readonly pole: Object3D; /** Solve target. When undefined, `solve()` is a no-op. */ target?: Object3D | undefined; /** Numerical stability threshold. */ epsilon: number; /** * Twists the root bone around its aim axis so that `rootPoleAxis` aligns toward the pole. */ rootPoleTwist: boolean; /** * Root bone's local-space axis aligned toward the pole when `rootPoleTwist` is enabled. * Default: `(0, 1, 0)`. */ rootPoleAxis: Vector3; /** * Twists the middle bone around its aim axis so that `middlePoleAxis` aligns toward the pole. */ middlePoleTwist: boolean; /** * Middle bone's local-space axis aligned toward the pole when `middlePoleTwist` is enabled. * Default: `(0, 1, 0)`. */ middlePoleAxis: Vector3; private readonly rootPosition; private readonly middlePosition; private readonly endPosition; private readonly targetPosition; private readonly polePosition; private readonly chainDirection; private readonly perpendicularDirection; private readonly middleTarget; private readonly currentDirection; private readonly desiredDirection; private readonly bonePosition; private readonly childPosition; private readonly aimAxis; private readonly currentUp; private readonly desiredUp; private readonly deltaRotation; private readonly boneWorldQuaternion; private readonly parentWorldQuaternion; private readonly twistRotation; constructor( /** First bone in the chain (e.g. upper leg, upper arm). */ root: Object3D, /** Second bone in the chain (e.g. lower leg, forearm). */ middle: Object3D, /** Terminal bone (e.g. foot, hand). Not rotated by the solver. */ end: Object3D, /** Controls the bend direction of the middle joint. */ pole: Object3D, /** Solve target. When undefined, `solve()` is a no-op. */ target?: Object3D | undefined); /** No-op when `target` is undefined. */ solve(): void; /** * Twist `bone` around its aim axis (bone→child) so that `poleAxis` * (bone's local space) points toward the pole. * * Resolves the roll ambiguity left by `aimBone`, * which constrains aim direction but not roll. */ private twistBoneTowardPole; /** * Rotate `bone` so that `child` points toward `worldTarget`. * Writes `bone.quaternion` in local space. */ private aimBone; }