import { BufferGeometry, LineSegments, type Material } from 'three'; import { type CellComplex, type HomogeneousSimplexLiftN, type DisplayMap3D, type SourceCellReferenceN, type TransformN } from '@holotope/core'; export interface ProjectedEdges3DOptions { /** Default material colour when `material` is omitted. */ color?: number; material?: Material; } /** * Render product: the 1-skeleton (edges) of an N-dimensional cell complex, * projected to 3D and rendered as three.js LineSegments. * * This is the CPU "golden path": N-D transform and projection happen in * Float64 on the CPU each update; only the final 3D positions are uploaded * to the GPU. The geometry is indexed: its position attribute contains one * projected entry per source vertex, while its index buffer contains the * segment endpoints. It is not a flattened endpoint list. Vertex order is * preserved 1:1 through projection, so the i-th position still corresponds * to source vertex i (provenance for picking and debugging). */ export declare class ProjectedEdges3D { 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: LineSegments; private readonly worldPositions; private readonly positionAttribute; private readonly edgeReferences; private readonly homogeneousProjection; private readonly homogeneousPositions; private readonly homogeneousValidity; /** * Builds the render product and allocates its geometry once; updates * thereafter rewrite the position buffer in place. * * @param complex - Source complex. Its 1-cells become the line segments; * a complex with no 1-cells is rejected, since there would be nothing to * draw. * @param projection - Map applied on every update. Its `fromDim` must equal * the complex's `ambientDim`, and the mismatch is rejected here rather than * at the first update. * @param options - A default material colour or a complete material * override. They are mutually exclusive. Unknown keys are rejected; * WebGL ignores line width, so `linewidth` is not an accepted styling * option and visual weight should be expressed through colour and opacity. * * @example * A rotating tesseract. The transform is applied in R⁴ and the projection * recomputed, which is what makes the wireframe change shape; rotating * `product.object` instead would only turn its shadow. * ```ts * const product = new ProjectedEdges3D( * createHypercube({ dim: 4 }), * new PerspectiveProjection({ fromDim: 4, viewDistance: 4 }) * ); * scene.add(product.object); * * const angle = Math.PI / 6; * product.update(new TransformN(4, rotationFromPlanes(4, [{ i: 0, j: 3, angle }]))); * ``` */ constructor(complex: CellComplex, projection: DisplayMap3D, options?: ProjectedEdges3DOptions); /** * Recomputes projected positions, optionally applying an N-D world * transform first. Call once per frame (or whenever the transform, * projection parameters, or source positions change). * * @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; /** * Provenance lookup for picking: the two source-complex vertex indices of * a rendered segment. For a `Raycaster` intersection with `object`, the * segment index is `intersection.index / 2` (three.js reports the index- * buffer position of the segment's first vertex). */ edgeVertices(segmentIndex: number): [number, number]; /** Lifecycle-aware reference to the source edge of a rendered segment. */ sourceReferenceOfSegment(segmentIndex: number): SourceCellReferenceN; /** * Lifts one point on a rendered segment to the current ambient N-D edge. * The point must be in this object's local representation coordinates. */ liftSegmentPoint(segmentIndex: number, pointLocal: ArrayLike): HomogeneousSimplexLiftN; private homogeneousVertex; dispose(): void; } //# sourceMappingURL=projected-edges.d.ts.map