import { CellComplex, VecN, type CellGroup, type SourceSimplexReferenceN } from '@holotope/core'; import { type XpbdIncrementalPotentialStepFilterContextN, type XpbdIncrementalPotentialStepFilterN } from './xpbd-incremental-potential-step-filter.js'; import { XpbdParticleBindingN } from './xpbd-particle-binding.js'; import { XpbdSourceSimplexAabbHierarchyN, type XpbdSourceSimplexAabbQueryDiagnosticsN } from './xpbd-source-simplex-aabb-hierarchy.js'; import { type XpbdParticleSourceSimplexBarrierEvaluationN, type XpbdParticleSourceSimplexBarrierStepFilterEvaluationN, type XpbdParticleSourceSimplexBarrierStepFilterRefusalReasonN } from './xpbd-source-simplex-barrier.js'; import { XpbdParticleN, XpbdWorldN, type XpbdConservativeForceProviderEvaluationN, type XpbdConservativeForceProviderN, type XpbdParticlePositionQueryN } from './xpbd-world.js'; /** One stable source-vertex--obstacle-simplex candidate identity. */ export interface XpbdParticleSourceSimplexCandidateN { /** Family-scoped stable identity for this source-feature pair. */ readonly id: string; /** Dynamic source vertex whose bound particle supplies the point. */ readonly sourceVertexIndex: number; /** Exact live particle bound to `sourceVertexIndex`. */ readonly particle: XpbdParticleN; /** Obstacle cell ordinal within the compiled simplex group. */ readonly obstacleCellIndex: number; /** Persistent finite obstacle simplex. */ readonly simplex: SourceSimplexReferenceN; } /** How one candidate query was organized, and what it cost. */ export interface XpbdParticleSourceSimplexCandidateDiagnosticsN { /** * Rejection rule and search organization. * * `'exhaustive-swept-aabb'` remains the default and the correctness oracle. * `'hierarchical-swept-aabb'` applies the identical inclusive AABB rule to * the identical per-simplex bounds, reached through a compiled static * hierarchy instead of a full scan. */ readonly provider: 'exhaustive-swept-aabb' | 'hierarchical-swept-aabb'; /** The selected search strategy, stated separately from the rejection rule. */ readonly strategy: 'exhaustive' | 'static-aabb-hierarchy'; /** Dynamic source vertices considered. */ readonly sourceVertexCount: number; /** Static obstacle simplices considered. */ readonly obstacleSimplexCount: number; /** Complete bipartite pair count before rejection. */ readonly possiblePairs: number; /** Pairs retained by conservative coordinate-interval overlap. */ readonly candidatePairs: number; /** Pairs proven unable to enter the activation envelope. */ readonly rejectedPairs: number; /** Coordinate interval comparisons performed before early exits. */ readonly axisTests: number; /** * Per-query hierarchy work, summed over dynamic vertices. * * Absent under the exhaustive default, where no hierarchy ran. Present * counts are operations, never times. */ readonly hierarchy?: XpbdSourceSimplexAabbQueryDiagnosticsN; } /** Immutable candidate set valid only for the point or segment queried. */ export interface XpbdParticleSourceSimplexCandidateQueryN { /** Whether the bounds enclose one point or one complete linear segment. */ readonly scope: 'point' | 'segment'; /** Activation distance used to expand every point bound. */ readonly activationDistance: number; /** Source-ordered candidates; identity remains stable across queries. */ readonly candidates: readonly XpbdParticleSourceSimplexCandidateN[]; /** Auditable reduction counts. */ readonly diagnostics: XpbdParticleSourceSimplexCandidateDiagnosticsN; } /** Construction options for one dynamic point--static-simplex barrier family. */ export interface CompileXpbdParticleSourceSimplexBarrierFamilyNOptions { /** Stable provider identity and candidate-ID prefix. */ readonly id: string; /** One live particle per authoritative dynamic source vertex. */ readonly binding: XpbdParticleBindingN; /** Separate static obstacle complex supplying finite simplices. */ readonly obstacle: CellComplex; /** Non-empty simplex group belonging to `obstacle`. */ readonly simplexGroup: CellGroup; /** Open unsigned-distance boundary. Default zero. */ readonly minimumDistance?: number; /** Distance at and above which every pair energy is zero. */ readonly activationDistance: number; /** Positive energy scale shared by active pairs. */ readonly stiffness: number; /** * Caller policy forwarded verbatim to every generated barrier. * * A dimensionless Euclidean radius on the published unit direction, finite * and in `(0, 2)`. Required whenever the obstacle group's simplex dimension * is 1..3 (the exact arm) and rejected for 4..17, exactly as on a single * barrier — the family has **no** default of its own, so no generated * barrier can inherit a hidden policy. */ readonly maximumDirectionError?: number; /** Fraction of each certified Lipschitz prefix retained. Default `0.9`. */ readonly conservativeScale?: number; /** * Optional precompiled static hierarchy over the same obstacle and group. * * Omitting it keeps the exhaustive scan, which stays the default and the * oracle. When supplied it must index the exact `obstacle` and * `simplexGroup` objects this family indexes — a structurally identical * hierarchy over a different source is not interchangeable, because the * bounds it cached describe different coordinates. * * There is no `'fast'` string and no size threshold. A hierarchy is a thing * the caller compiled and can inspect, not a mode the library picks. */ readonly candidateHierarchy?: XpbdSourceSimplexAabbHierarchyN; } /** One active pair's finite-distance barrier evidence. */ export interface XpbdParticleSourceSimplexActiveCandidateN { /** Source-retained feature-pair identity. */ readonly candidate: XpbdParticleSourceSimplexCandidateN; /** P44 finite-distance energy, force, and closest barycentric coordinate. */ readonly evaluation: XpbdParticleSourceSimplexBarrierEvaluationN; } /** Aggregate conservative evaluation over only point-query-active pairs. */ export interface XpbdParticleSourceSimplexBarrierFamilyEvaluationN extends XpbdConservativeForceProviderEvaluationN { /** Conservative point query used before exact distance evaluation. */ readonly candidateQuery: XpbdParticleSourceSimplexCandidateQueryN; /** Pairs whose exact distance is below the activation distance. */ readonly activeCandidates: readonly XpbdParticleSourceSimplexActiveCandidateN[]; /** One accumulated force per bound source vertex. */ readonly forces: readonly VecN[]; } /** One segment candidate paired with its P44 admissible-prefix evidence. */ export interface XpbdParticleSourceSimplexSegmentCandidateN { /** Source-retained feature-pair identity. */ readonly candidate: XpbdParticleSourceSimplexCandidateN; /** Safe, limited, or explicitly refused finite-simplex certification. */ readonly evaluation: XpbdParticleSourceSimplexBarrierStepFilterEvaluationN; } /** * Why an aggregate point--simplex segment query refused certification. * * Deliberately the CANDIDATE filter's own vocabulary, not a re-labelled copy of * it. The family adds no new failure mode: it refuses exactly when one of its * candidates refuses, so re-stating that candidate's reason under an * aggregate-specific name would replace a measured cause with a prefix. Which * candidate refused is carried by `blockingCandidateId`, and the full * per-candidate evaluation stays in `candidates`. */ export type XpbdParticleSourceSimplexBarrierFamilyStepFilterRefusalReasonN = XpbdParticleSourceSimplexBarrierStepFilterRefusalReasonN; /** Aggregate candidate and certification evidence for one proposed segment. */ export type XpbdParticleSourceSimplexBarrierFamilyStepFilterEvaluationN = { /** Conservative candidate set for this exact proposed segment. */ readonly candidateQuery: XpbdParticleSourceSimplexCandidateQueryN; /** Per-candidate finite-simplex certifications in stable source order. */ readonly candidates: readonly XpbdParticleSourceSimplexSegmentCandidateN[]; /** Pair imposing the aggregate limit or refusal, otherwise `null`. */ readonly blockingCandidateId: string | null; } & ({ readonly status: 'safe'; readonly maximumStepLength: number; } | { readonly status: 'limited'; readonly maximumStepLength: number; } | { readonly status: 'indeterminate'; readonly reason: XpbdParticleSourceSimplexBarrierFamilyStepFilterRefusalReasonN; }); /** Provider/filter pair accepted by an incremental-potential problem. */ export interface XpbdParticleSourceSimplexBarrierFamilyTermsN { /** Existing providers followed by this dynamic family provider. */ readonly providers: readonly XpbdConservativeForceProviderN[]; /** Existing filters followed by this family's candidate-aware filter. */ readonly stepFilters: readonly XpbdIncrementalPotentialStepFilterN[]; } /** * Source-indexed RN barriers from dynamic points to a static simplex mesh. * * The family keeps one authoritative particle binding and persistent obstacle * simplex references. At each evaluation it visits the complete bipartite * source-feature space, rejects pairs only by a conservative coordinate-bound * proof, and instantiates P44 barriers only for the retained candidates. The * paired step filter repeats that query over the complete proposed segment. * * This is a deterministic Float64 reference active set, not a spatial tree. * Candidate sets are scoped to the point or segment named by their query and * must not be cached across changed coordinates. The obstacle is one-sided * and static during a solve; moving--moving and mesh self-contact are outside * this contract. */ export declare class XpbdParticleSourceSimplexBarrierFamilyN implements XpbdConservativeForceProviderN { /** Stable conservative-provider identity. */ readonly id: string; /** Ambient dynamic-source and obstacle dimension. */ readonly dimension: number; /** Authoritative dynamic source-to-particle mapping. */ readonly binding: XpbdParticleBindingN; /** Bound particles in source-vertex order. */ readonly particles: readonly XpbdParticleN[]; /** Separate static obstacle source. */ readonly obstacle: CellComplex; /** Compiled obstacle simplex group. */ readonly simplexGroup: CellGroup; /** Persistent obstacle simplices in group-cell order. */ readonly simplices: readonly SourceSimplexReferenceN[]; /** Open unsigned-distance boundary. */ readonly minimumDistance: number; /** Exact-zero barrier boundary and candidate-envelope padding. */ readonly activationDistance: number; /** Positive energy scale shared by pair barriers. */ readonly stiffness: number; /** * Caller-authored direction policy forwarded to every generated barrier, or * `null` on the legacy 4..17 arm. The family holds no default of its own. */ readonly maximumDirectionError: number | null; /** Strict prefix scale shared by pair filters. */ readonly conservativeScale: number; /** * Selected static hierarchy, or `null` for the exhaustive default. * * Public so the chosen strategy is inspectable from the family itself, not * only from a query it happened to run. */ readonly candidateHierarchy: XpbdSourceSimplexAabbHierarchyN | null; /** Candidate-aware admissible-segment filter paired with this provider. */ readonly stepFilter: XpbdParticleSourceSimplexBarrierFamilyStepFilterN; private attachedWorld; private constructor(); /** Compiles persistent source identities and the paired segment filter. */ static compile(options: CompileXpbdParticleSourceSimplexBarrierFamilyNOptions): XpbdParticleSourceSimplexBarrierFamilyN; /** Queries candidates at one particle-space state without evaluating energy. */ queryAt(positionOf: XpbdParticlePositionQueryN): XpbdParticleSourceSimplexCandidateQueryN; /** Evaluates candidates from the particles' current positions. */ evaluate(): XpbdParticleSourceSimplexBarrierFamilyEvaluationN; /** Evaluates active candidate barriers without mutating live state. */ evaluateAt(positionOf: XpbdParticlePositionQueryN): XpbdParticleSourceSimplexBarrierFamilyEvaluationN; /** Returns this provider and its paired filter, optionally after base terms. */ incrementalPotentialTerms(base?: XpbdParticleSourceSimplexBarrierFamilyTermsN): XpbdParticleSourceSimplexBarrierFamilyTermsN; /** Registers this one dynamic provider; particles must already be present. */ addToWorld(world: XpbdWorldN): XpbdWorldN; } /** Candidate-aware aggregate segment filter paired with one barrier family. */ export declare class XpbdParticleSourceSimplexBarrierFamilyStepFilterN implements XpbdIncrementalPotentialStepFilterN { /** Stable authored filter identity. */ readonly id: string; /** Ambient particle and obstacle dimension. */ readonly dimension: number; /** Exact particles whose proposed segments are inspected. */ readonly particles: readonly XpbdParticleN[]; /** Paired dynamic barrier family. */ readonly family: XpbdParticleSourceSimplexBarrierFamilyN; /** Creates the one filter owned by a compiled family. */ constructor(family: XpbdParticleSourceSimplexBarrierFamilyN); /** Certifies the complete segment using only its conservative candidates. */ evaluate(context: XpbdIncrementalPotentialStepFilterContextN): XpbdParticleSourceSimplexBarrierFamilyStepFilterEvaluationN; } /** Compiles a dynamic point--static-simplex family and paired filter. */ export declare function compileXpbdParticleSourceSimplexBarrierFamilyN(options: CompileXpbdParticleSourceSimplexBarrierFamilyNOptions): XpbdParticleSourceSimplexBarrierFamilyN; //# sourceMappingURL=xpbd-source-simplex-barrier-family.d.ts.map