import { CellComplex, VecN, type CellGroup, type SourceCellIdN, type SourceCellReferenceN } from '@holotope/core'; import { XpbdDistanceConstraintN } from './xpbd-constraint.js'; import { XpbdParticleN, XpbdWorldN } from './xpbd-world.js'; export interface XpbdDistanceNetworkVertexContextN { readonly sourceVertexIndex: number; /** Copied source position; callback mutation cannot edit the complex. */ readonly sourcePosition: VecN; } export interface XpbdDistanceNetworkEdgeContextN { readonly sourceEdgeIndex: number; readonly sourceVertexIndices: readonly [number, number]; readonly sourceId: SourceCellIdN; readonly restLength: number; } export type XpbdDistanceNetworkVertexScalarN = number | ((vertex: XpbdDistanceNetworkVertexContextN) => number); export type XpbdDistanceNetworkEdgeComplianceN = number | ((edge: XpbdDistanceNetworkEdgeContextN) => number); export interface CompileXpbdDistanceNetworkNOptions { readonly id: string; readonly source: CellComplex; readonly edgeGroup: CellGroup; /** * Existing one-particle-per-source-vertex state. When supplied, vertex * authoring policies are forbidden and source geometry still defines rest. */ readonly particles?: readonly XpbdParticleN[]; readonly inverseMass?: XpbdDistanceNetworkVertexScalarN; readonly gravityScale?: XpbdDistanceNetworkVertexScalarN; readonly velocity?: (vertex: XpbdDistanceNetworkVertexContextN) => VecN | ArrayLike; readonly compliance?: XpbdDistanceNetworkEdgeComplianceN; } export interface XpbdDistanceNetworkEdgeN extends XpbdDistanceNetworkEdgeContextN { readonly sourceReference: SourceCellReferenceN; readonly constraint: XpbdDistanceConstraintN; } /** Compiled live point state plus its immutable source-topology correspondence. */ export declare class XpbdDistanceNetworkN { readonly id: string; readonly dimension: number; readonly source: CellComplex; readonly sourceEdgeGroup: CellGroup; readonly particles: readonly XpbdParticleN[]; readonly edges: readonly XpbdDistanceNetworkEdgeN[]; readonly constraints: readonly XpbdDistanceConstraintN[]; private attachedWorld; private constructor(); static compile(options: CompileXpbdDistanceNetworkNOptions): XpbdDistanceNetworkN; particleForSourceVertex(sourceVertexIndex: number): XpbdParticleN; /** Registers this complete product in one RN point world. */ addToWorld(world: XpbdWorldN): XpbdWorldN; /** * Copies live particle coordinates into the same source complex. * * Source topology and every structural edge id are validated before the * packed position buffer is changed. */ writeSourcePositions(): CellComplex; } /** Compiles one explicitly selected source 1-cell family into an XPBD network. */ export declare function compileXpbdDistanceNetworkN(options: CompileXpbdDistanceNetworkNOptions): XpbdDistanceNetworkN; //# sourceMappingURL=xpbd-network.d.ts.map