/** * Cell complexes: the N-dimensional counterpart of a mesh. * * A CellComplex stores vertex positions in ambient ℝⁿ plus groups of cells * organized by intrinsic dimension: 1-cells (edges), 2-cells (faces), * 3-cells (tetrahedra or cuboids), and so on. The ambient dimension is * explicit on the object and never inferred from buffer sizes, so * mixed-dimension bugs fail fast. */ /** * How to interpret a cell's vertex tuple: a simplex (any dim), a cuboid * (binary corner order), or a polygon — a planar 2-cell whose vertices * form a cyclically ordered loop of any arity ≥ 3. */ export type CellKind = 'simplex' | 'cuboid' | 'polygon'; /** A homogeneous group of k-cells sharing arity and interpretation. */ export interface CellGroup { /** * Optional author-supplied structural identity for this group. * * Keys must be unique inside one complex. They are not required for * rendering, but make source-cell ids stable across order-independent * regeneration and serialization boundaries. */ key?: string; /** Intrinsic dimension of each cell (1 = edge, 2 = face, 3 = solid cell…). */ dim: number; /** Number of vertex indices per cell (2 for an edge, 4 for a quad or tet…). */ verticesPerCell: number; kind: CellKind; /** Flat vertex indices, length = cellCount * verticesPerCell. */ indices: Uint32Array; } export declare class CellComplex { readonly ambientDim: number; /** Packed vertex coordinates, length = vertexCount * ambientDim. */ positions: Float64Array; groups: CellGroup[]; /** * Assembles vertex positions and cell groups into a complex, validating * that every group indexes vertices that exist. * * @param ambientDim - Dimension each vertex is expressed in. `positions` * must be a whole number of vertices at this width. * @param positions - Packed vertex coordinates, vertex-major: coordinate * `c` of vertex `v` is at `v * ambientDim + c`. Retained, not copied. * @param groups - Cells by dimension and kind. Each is validated on * construction, so an index outside the vertex range is rejected here * rather than when something tries to draw it. * * @example * A single square in the plane. Builders are the usual source of a complex; * this is the shape they produce. * ```ts * const square = new CellComplex(2, Float64Array.of(0, 0, 1, 0, 1, 1, 0, 1), [ * { dim: 1, kind: 'cuboid', verticesPerCell: 2, indices: Uint32Array.of(0, 1, 1, 2, 2, 3, 3, 0) } * ]); * square.vertexCount; // 4 * ``` */ constructor(ambientDim: number, positions: Float64Array, groups?: CellGroup[]); get vertexCount(): number; cellsOfDim(dim: number): CellGroup[]; cellCount(dim: number): number; addGroup(group: CellGroup): this; /** Copies vertex `i` into `out` (length ambientDim), allocating if omitted. */ getPosition(i: number, out?: Float64Array): Float64Array; private validateGroup; private validateUniqueExplicitKeys; } //# sourceMappingURL=cell-complex.d.ts.map