import { CellComplex, type CellGroup, type CuboidSimplexizationN, type SourceCellIdN, type SourceCellReferenceN } from '@holotope/core'; import { XpbdOrientedSimplexMeasureConstraintN } from './xpbd-simplex-measure.js'; import { XpbdParticleN, XpbdWorldN } from './xpbd-world.js'; /** * Where one simplex of a decomposed cuboid came from. * * A cuboid carries no measure constraint directly, so each is cut into * simplices by lexicographic axis permutations — n! of them for an n-cube, * the six-tetrahedron decomposition at n = 3 — and the constraint is written * per simplex. Every field here exists so a constraint can be traced back to * the cuboid it came from rather than standing alone. */ export interface XpbdOrientedCuboidFamilyCellContextN { /** Index of this simplex across the whole decomposition. */ readonly simplexIndex: number; /** Index of the cuboid cell it was cut from. */ readonly sourceCellIndex: number; /** Which axis permutation produced it, as a lexicographic ordinal. */ readonly permutationIndex: number; /** That permutation itself, as an axis ordering. */ readonly permutation: readonly number[]; /** Vertices of the source cuboid, indexing the complex. */ readonly sourceCuboidVertexIndices: readonly number[]; /** The subset of them forming this simplex, in the permutation's order. */ readonly sourceSimplexVertexIndices: readonly number[]; /** Structural identity of the source cuboid, stable across regeneration. */ readonly sourceId: SourceCellIdN; /** Signed measure of the whole source cuboid at authoring time. */ readonly sourceOrientedMeasure: number; } export type XpbdOrientedCuboidFamilyComplianceN = number | ((cell: XpbdOrientedCuboidFamilyCellContextN) => number); export type XpbdOrientedCuboidFamilyRestN = number | ((cell: XpbdOrientedCuboidFamilyCellContextN) => number); export interface CompileXpbdOrientedCuboidFamilyNOptions { readonly id: string; readonly source: CellComplex; readonly cuboidGroup: CellGroup; /** One live particle per source vertex, in source-vertex order. */ readonly particles: readonly XpbdParticleN[]; /** Default: signed measure of the generated source simplex at compile time. */ readonly restOrientedMeasure?: XpbdOrientedCuboidFamilyRestN; readonly compliance?: XpbdOrientedCuboidFamilyComplianceN; /** Passed to the deterministic cuboid simplexizer. Default 1,000,000. */ readonly maxOutputCells?: number; } /** * One simplex of a decomposed cuboid, with its provenance and the constraint * written over it. * * The measure is oriented — a determinant, `det([x₁ − x₀, …]) / N!` — so it is * signed rather than a volume. A constraint holding it near its rest value * therefore resists inversion as well as compression: a cell turning inside * out passes through zero and changes sign, which an unsigned volume * constraint cannot see at all. That is what distinguishes this family, and * why `restOrientedMeasure` is worth comparing against the live value rather * than its magnitude. */ export interface XpbdOrientedCuboidFamilyCellN extends XpbdOrientedCuboidFamilyCellContextN { /** Resolvable handle to the source cuboid, for inspection and picking. */ readonly sourceReference: SourceCellReferenceN; /** Signed measure of this simplex in the rest configuration; the value the * constraint holds it near, sign included. */ readonly restOrientedMeasure: number; /** The compliant constraint written over this simplex's measure. */ readonly constraint: XpbdOrientedSimplexMeasureConstraintN; } /** Source-identified oriented simplex constraints over full-dimensional cuboids. */ export declare class XpbdOrientedCuboidFamilyN { readonly id: string; readonly dimension: number; readonly source: CellComplex; readonly sourceCuboidGroup: CellGroup; readonly simplexization: CuboidSimplexizationN; readonly particles: readonly XpbdParticleN[]; readonly cells: readonly XpbdOrientedCuboidFamilyCellN[]; readonly constraints: readonly XpbdOrientedSimplexMeasureConstraintN[]; private attachedWorld; private constructor(); static compile(options: CompileXpbdOrientedCuboidFamilyNOptions): XpbdOrientedCuboidFamilyN; /** Adds only this family's constraints; particles must already belong to the world. */ addToWorld(world: XpbdWorldN): XpbdWorldN; } /** Compiles one full-dimensional cuboid family over existing RN particles. */ export declare function compileXpbdOrientedCuboidFamilyN(options: CompileXpbdOrientedCuboidFamilyNOptions): XpbdOrientedCuboidFamilyN; //# sourceMappingURL=xpbd-oriented-cuboid-family.d.ts.map