import { BufferGeometry, Mesh, type Material } from 'three'; import { type CellComplex, type HomogeneousSimplexLiftN, type DisplayMap3D, type SourceCellReferenceN, type TransformN } from '@holotope/core'; export interface ProjectedSurface3DOptions { material?: Material; } /** * Render product: the 2-skeleton (faces) of an N-dimensional cell complex, * projected to 3D and rendered as a shaded Mesh. * * Faces come from the complex's 2-cell groups — simplex triangles directly; * cuboid quads and polygon loops fan-triangulated from their first corner. * The projected boundary of a 4D object overlaps * itself in 3D (cells in front of and behind the hidden axis project onto * each other), so the default material is translucent and double-sided; * flat normals are recomputed per update over the triangle soup. * * That default also disables depth writing. Without it, translucent triangles * of a self-intersecting surface occlude one another in buffer order rather * than depth order, which reads as flicker while the source turns. An * override that keeps the transparency should keep `depthWrite: false` with * it. * * A face's shading can invert abruptly as the source rotates. Each normal is * the cross product of a triangle's projected edges, and a cell passing * through the hidden axis reverses its projected orientation — the same event * that makes a rotating tesseract appear to turn inside out. The normal flips * with it. This is the projection reporting a real change of orientation, not * a shading artefact, and it is most visible on complexes with many faces. * * Provenance: `sourceFaceOfTriangle` maps a Raycaster faceIndex back to * the source 2-cell, and `faceVertices` to its source vertex indices. */ export declare class ProjectedSurface3D { readonly complex: CellComplex; /** * The display map applied on every update. Historically named `projection` * (renaming a shipped field is an API break); it accepts any * `DisplayMap3D`, lossy or injective — an embedded R2 complex draws through * exactly the same path as a projected R4 one. */ readonly projection: DisplayMap3D; readonly geometry: BufferGeometry; readonly object: Mesh; private readonly worldPositions; private readonly projectedVertices; private readonly soupToVertex; private readonly triangleToFace; private readonly faceReferences; private readonly positionAttribute; private readonly normalAttribute; private readonly homogeneousProjection; private readonly homogeneousPositions; private readonly homogeneousValidity; /** * Builds the render product, fan-triangulating each 2-cell once. Updates * rewrite positions and recompute flat normals; the triangulation is fixed. * * @param complex - Source complex. Its 2-cells become the triangle soup; * a complex storing no 2-cells is rejected, so a builder that emits only * edges and volumes cannot be rendered as a surface. * @param projection - Map applied on every update; its `fromDim` must equal * the complex's `ambientDim`. * @param options - Material override. A projected surface self-intersects * in general, so the default is translucent and double-sided. * * @example * ```ts * const faces = new ProjectedSurface3D( * create24Cell(), * new PerspectiveProjection({ fromDim: 4, viewDistance: 4 }) * ); * scene.add(faces.object); * ``` */ constructor(complex: CellComplex, projection: DisplayMap3D, options?: ProjectedSurface3DOptions); get triangleCount(): number; /** Source 2-cell (index into the concatenated face cells) of a triangle. */ sourceFaceOfTriangle(faceIndex: number): number; /** Source-complex vertex indices of a rendered triangle. */ faceVertices(faceIndex: number): [number, number, number]; /** Lifecycle-aware reference to the source 2-cell of a rendered triangle. */ sourceReferenceOfTriangle(faceIndex: number): SourceCellReferenceN; /** * Lifts one point on a rendered triangle to its current ambient N-D source * simplex. The point must be in this object's local representation frame. */ liftTrianglePoint(faceIndex: number, pointLocal: ArrayLike): HomogeneousSimplexLiftN; /** * Recomputes projected positions and flat normals. Call per frame. * * @param transform - Optional transform in the source complex's ambient * dimension. A mismatch is rejected before any render buffer is changed. */ update(transform?: TransformN): void; private homogeneousVertex; dispose(): void; } //# sourceMappingURL=projected-surface.d.ts.map