import { VecN } from '@holotope/core'; import { type ConstraintRow4 } from './constraint-row4.js'; import { type DistanceConstraintEvaluationN, type DistanceCoordinateEvaluationN } from './distance-coordinate-n.js'; import { RigidBody4 } from './rigid-body4.js'; /** * What every distance coordinate needs regardless of what it measures to: * an identity, one body, and the anchor on it. Variants extend this with a * second body, a fixed point, or a surface. */ export interface DistanceCoordinate4BaseOptions { /** Stable identity, so a solver can warm-start this coordinate. */ readonly id: string; /** The body carrying the first anchor. */ readonly bodyA: RigidBody4; /** Anchor position in `bodyA`'s local frame, not world space. */ readonly localAnchorA: VecN | ArrayLike; /** Coherent distance gradient used only when the two anchors coincide. */ readonly directionHint?: VecN | ArrayLike; } export type DistanceCoordinate4Options = DistanceCoordinate4BaseOptions & ({ readonly bodyB: RigidBody4; readonly localAnchorB: VecN | ArrayLike; } | { readonly bodyB?: null; readonly worldAnchorB: VecN | ArrayLike; }); /** Reusable local/world anchor binding for one scalar distance coordinate. */ export declare class DistanceCoordinate4 { /** Stable identity, so a solver can warm-start this coordinate. */ readonly id: string; /** The body carrying the first anchor. */ readonly bodyA: RigidBody4; /** First anchor in `bodyA`'s local frame, not world space. */ readonly localAnchorA: VecN; /** * The body carrying the second anchor, or null when it is pinned to the * world — which is what distinguishes a two-body joint from an anchor. */ readonly bodyB: RigidBody4 | null; /** * The second anchor, read in `bodyB`'s local frame when there is one and in * world space otherwise. The frame follows `bodyB`, so the two cases cannot * be told apart from this field alone. */ readonly anchorB: VecN; protected directionHint: VecN | undefined; constructor(options: DistanceCoordinate4Options); worldAnchorA(): VecN; worldAnchorB(): VecN; evaluation(): DistanceCoordinateEvaluationN; protected evaluateAnchors(anchorA: VecN, anchorB: VecN): DistanceCoordinateEvaluationN; } export interface DistanceJointConstraint4 extends ConstraintRow4 { readonly anchorA: VecN; readonly anchorB: VecN; readonly direction: VecN; readonly currentLength: number; readonly restLength: number; readonly positionError: number; } export type DistanceJoint4Options = DistanceCoordinate4Options & { /** Captures the construction-pose distance when omitted. */ readonly restLength?: number; }; /** Persistent local-anchor binding for a rigid R4 distance equality. */ export declare class DistanceJoint4 extends DistanceCoordinate4 { readonly restLength: number; constructor(options: DistanceJoint4Options); evaluation(): DistanceConstraintEvaluationN; constraint(): DistanceJointConstraint4; } //# sourceMappingURL=distance-joint4.d.ts.map