/** * ConstraintSolver.ts * * Sequential-impulse / PGS constraint solver for the HoloScript physics * engine. Supports the 8 joint constraint types in PhysicsTypes.ts plus a * unilateral contact constraint (normal + friction). * * This is a REAL impulse solver, not a position-bias heuristic: * - Each constraint row computes its effective mass `K = J·M⁻¹·Jᵀ` and the * impulse `lambda = -(J·v + bias)/K`, mass-weighted via inverse mass / * inverse inertia (constraint-impulse.ts). * - Impulses ACCUMULATE across the iteration loop and are clamped on the * TOTAL accumulated value (proper PGS), so the 10-iteration loop actually * converges instead of being a no-op multiplier. * - Warm-starting re-injects the previous frame's accumulated impulse at the * start of the solve. * - Contacts resolve as unilateral normal impulses (clamped >= 0) plus * Coulomb-clamped friction; restitution and Baumgarte penetration bias are * folded into the row bias. * * The public API and return shape are unchanged: `solve(dt)` returns a Map of * per-body velocity corrections (the Δv each body should receive this step). * * @module physics */ import { IVector3, Constraint, IRigidBodyState } from './PhysicsTypes'; export interface ConstraintSolverConfig { iterations: number; baumgarte: number; warmStarting: boolean; slop: number; } export declare class ConstraintSolver { private config; private solved; constructor(config?: Partial); addConstraint(constraint: Constraint, bodyA: IRigidBodyState, bodyB?: IRigidBodyState | null): void; removeConstraint(constraintId: string): boolean; getConstraints(): Constraint[]; /** * Solve all constraints for one timestep using sequential impulses. * * Returns the velocity correction (Δv) to apply to each rigid body — the * difference between the post-solve velocity and the body's input velocity. * The caller integrates these onto the bodies; the solver never mutates the * caller's IRigidBodyState objects. */ solve(dt: number): Map; getBrokenConstraints(): string[]; clear(): void; private solveConstraint; private solvePoint; private solveDistance; private solveSpring; private solveHinge; private solveSlider; private solveCone; private solveGeneric6DOF; private solveContact; private warmStart; } //# sourceMappingURL=ConstraintSolver.d.ts.map