import { VecN } from '@holotope/core'; import type { ContactTangentBasis4 } from './contact-kinematics4.js'; import { type ConstraintParticipant4 } from './constraint-row4.js'; import type { HyperboxContactPatch4 } from './hyperbox-contact4.js'; import type { HyperboxHyperplaneContactPatch4 } from './mixed-contact4.js'; import type { PolytopeContactPatch4 } from './polytope-contact4.js'; import type { PolytopeHyperplaneContactPatch4 } from './polytope-plane-contact4.js'; import type { SmoothPointContactPatchN } from './smooth-contact.js'; /** Dynamic body, prescribed rigid motion, or an immovable participant. */ export type ContactParticipant4 = ConstraintParticipant4; export interface ContactConstraint4 { /** Must be unique within a solver; persistent IDs retain warm impulses. */ readonly id: string; readonly participantA: ContactParticipant4; readonly participantB: ContactParticipant4; /** Unit direction from B toward A. Non-unit finite inputs are normalized. */ readonly normal: VecN; /** Actual world-space surface witness on A in the current pose. */ readonly anchorA: VecN; /** Actual world-space surface witness on B in the current pose. */ readonly anchorB: VecN; /** Non-negative overlap used only for velocity-level position bias. */ readonly penetrationDepth?: number; /** Newton restitution coefficient in [0, 1]. Default 0. */ readonly restitution?: number; /** Isotropic Coulomb coefficient for the full R4 tangent 3-ball. Default 0. */ readonly friction?: number; } /** Backward-compatible name for a constraint whose friction is omitted. */ export type NormalContactConstraint4 = ContactConstraint4; export interface ContactSolver4Options { /** Projected block Gauss-Seidel passes. Default 8. */ iterations?: number; /** Closing speed below which restitution is suppressed. Default 0.5. */ restitutionThreshold?: number; /** Fraction of excess penetration corrected per step. Default 0.2. */ baumgarte?: number; /** Penetration ignored by position bias. Default 0.005. */ penetrationSlop?: number; /** Upper bound on position-bias separation speed. Default 2. */ maxBiasSpeed?: number; /** Apply coherent impulses retained from the previous solve. Default true. */ warmStart?: boolean; } export type NormalContactSolver4Options = ContactSolver4Options; export type ContactFrictionState4 = 'disabled' | 'inactive' | 'sticking' | 'sliding'; export interface ContactPointResult4 { readonly id: string; /** Scalar normal effective mass. */ readonly effectiveMass: number; readonly initialNormalSpeed: number; readonly targetNormalSpeed: number; readonly restitutionSpeed: number; readonly biasSpeed: number; readonly warmStartedImpulse: number; readonly accumulatedImpulse: number; readonly finalNormalSpeed: number; readonly frictionCoefficient: number; /** Coherent orthonormal basis of the three-dimensional tangent space. */ readonly tangentBasis: ContactTangentBasis4; /** Row-major 3x3 map from tangent impulse coordinates to relative speed. */ readonly tangentResponse: Float64Array; readonly initialTangentSpeeds: readonly [number, number, number]; readonly warmStartedTangentImpulse: readonly [number, number, number]; readonly accumulatedTangentImpulse: readonly [number, number, number]; readonly tangentImpulseWorld: VecN; readonly finalTangentSpeeds: readonly [number, number, number]; /** Radius mu * lambda_n of the admissible tangent impulse ball. */ readonly frictionLimit: number; readonly frictionState: ContactFrictionState4; } export type NormalContactPointResult4 = ContactPointResult4; export interface ContactSolveResult4 { readonly points: readonly ContactPointResult4[]; readonly retiredIds: readonly string[]; readonly iterations: number; readonly totalNormalImpulse: number; readonly totalTangentImpulse: number; readonly maxClosingSpeed: number; readonly maxTangentialSpeed: number; } export type NormalContactSolveResult4 = ContactSolveResult4; export interface HyperboxNormalContactConstraintsOptions4 { /** Namespace for feature-pair IDs; normally the colliding body-pair ID. */ readonly pairId: string; readonly restitution?: number; /** Bounded solver subset (default) or every geometric patch vertex. */ readonly pointSource?: 'solver' | 'vertices'; } export interface HyperboxContactConstraintsOptions4 extends HyperboxNormalContactConstraintsOptions4 { readonly friction?: number; } export interface PolytopeContactConstraintsOptions4 extends HyperboxNormalContactConstraintsOptions4 { readonly friction?: number; } export interface SmoothPointContactConstraintOptions4 { /** Namespace for the persistent smooth-point ID. */ readonly pairId: string; readonly restitution?: number; readonly friction?: number; } export interface HyperboxHyperplaneContactConstraintsOptions4 { /** Namespace for the persistent support-feature point IDs. */ readonly pairId: string; readonly restitution?: number; readonly friction?: number; } export type PolytopeHyperplaneContactConstraintsOptions4 = HyperboxHyperplaneContactConstraintsOptions4; /** * Warm-started R4 contact solver with a scalar normal constraint and one * coupled three-coordinate friction constraint at every contact point. * * The tangent impulse is projected onto the Euclidean ball * `||lambda_t|| <= mu lambda_n`. The full 3x3 tangent response is solved as a * block, so friction is isotropic and invariant under a change of tangent * basis rather than being three independently clamped 1D constraints. */ export declare class ContactSolver4 { readonly iterations: number; readonly restitutionThreshold: number; readonly baumgarte: number; readonly penetrationSlop: number; readonly maxBiasSpeed: number; readonly warmStart: boolean; private cache; constructor(options?: ContactSolver4Options); solve(constraints: readonly ContactConstraint4[], dt: number): ContactSolveResult4; reset(): void; private prepare; private applyWarmStart; private solveNormal; private solveFriction; } /** * Normal-only compatibility solver. Friction values on supplied constraints * are deliberately ignored; use ContactSolver4 for coupled R4 friction. */ export declare class NormalContactSolver4 extends ContactSolver4 { solve(constraints: readonly NormalContactConstraint4[], dt: number): NormalContactSolveResult4; } /** Converts a resolved hyperbox patch into contact constraints at actual anchors. */ export declare function contactConstraintsFromHyperboxPatch4(patch: HyperboxContactPatch4, participantA: ContactParticipant4, participantB: ContactParticipant4, options: HyperboxContactConstraintsOptions4): readonly ContactConstraint4[]; /** Converts a resolved hyperbox patch into frictionless normal constraints. */ export declare function normalContactConstraintsFromHyperboxPatch4(patch: HyperboxContactPatch4, participantA: ContactParticipant4, participantB: ContactParticipant4, options: HyperboxNormalContactConstraintsOptions4): readonly NormalContactConstraint4[]; /** Converts a resolved vertex-polytope patch into persistent R4 constraints. */ export declare function contactConstraintsFromPolytopePatch4(patch: PolytopeContactPatch4, participantA: ContactParticipant4, participantB: ContactParticipant4, options: PolytopeContactConstraintsOptions4): readonly ContactConstraint4[]; /** Converts an exact box/plane support feature into response constraints. */ export declare function contactConstraintsFromHyperboxHyperplanePatch4(patch: HyperboxHyperplaneContactPatch4, participantA: ContactParticipant4, participantB: ContactParticipant4, options: HyperboxHyperplaneContactConstraintsOptions4): readonly ContactConstraint4[]; /** Converts a general polytope/plane support face into response constraints. */ export declare function contactConstraintsFromPolytopeHyperplanePatch4(patch: PolytopeHyperplaneContactPatch4, participantA: ContactParticipant4, participantB: ContactParticipant4, options: PolytopeHyperplaneContactConstraintsOptions4): readonly ContactConstraint4[]; /** Converts one exact smooth point patch into an R4 response constraint. */ export declare function contactConstraintFromSmoothPointPatch4(patch: SmoothPointContactPatchN, participantA: ContactParticipant4, participantB: ContactParticipant4, options: SmoothPointContactConstraintOptions4): ContactConstraint4; /** Frictionless compatibility form of the exact smooth point adapter. */ export declare function normalContactConstraintFromSmoothPointPatch4(patch: SmoothPointContactPatchN, participantA: ContactParticipant4, participantB: ContactParticipant4, options: Omit): NormalContactConstraint4; //# sourceMappingURL=normal-contact-solver4.d.ts.map