Commonplace kernel API
    Preparing search index...

    Interface IGeometryKernel

    Abstract interface for all geometry kernels in the host.

    Per ADR-008, the kernel is a single HalfEdgeMesh; non-linear edge geometry is carried via EdgeCurve on half-edges rather than in a parallel kernel. The type discriminant is retained so tools and the command system can program against the interface and future-ADR curve-family extensions land without interface churn.

    2025-Q4

    stable

    interface IGeometryKernel {
        config: Record<string, any>;
        id: string;
        onWarning: ((msg: string) => void) | null;
        type: "half-edge";
        clone(): IGeometryKernel;
        deleteEntities(ids: Set<string>): void;
        fromJSON(data: any): void;
        getBoundingBox(): KernelBoundingBox | null;
        toJSON(): any;
    }

    Implemented by

    Index
    config: Record<string, any>

    Arbitrary key/value configuration specific to the kernel implementation.

    Examples: face-detection BFS limits, rendering chord deviation.

    id: string

    Unique identifier for this kernel instance.

    Typically corresponds to a context definition ID in the scene graph, allowing commands and the undo system to locate the correct kernel after deserialization.

    onWarning: ((msg: string) => void) | null

    Optional callback invoked when the kernel encounters a non-fatal condition (e.g. degenerate face, dangling half-edge).

    Set to null to suppress warnings.

    Human-readable warning message.

    type: "half-edge"

    Discriminant that identifies the kernel implementation. Reserved for future variants; the only value today is 'half-edge'.

    • Creates an independent deep copy of this kernel.

      The clone shares no mutable state with the original, making it safe for speculative operations or background processing.

      Returns IGeometryKernel

      A new IGeometryKernel instance with identical geometry.

    • Deletes a set of entities (vertices, edges, and/or faces) by their IDs.

      The kernel is responsible for maintaining topological consistency after deletion (e.g. removing dangling half-edges when a face is deleted).

      Parameters

      • ids: Set<string>

        The set of entity IDs to remove.

      Returns void

    • Replaces the kernel's state with a previously serialized snapshot.

      Must accept the output of toJSON and restore the kernel to an identical state. Used by the undo/redo system.

      Parameters

      • data: any

        A snapshot previously produced by toJSON.

      Returns void

    • Computes the axis-aligned bounding box of all geometry in the kernel.

      Returns null if the kernel contains no geometry (e.g. an empty mesh). The returned object includes helper methods compatible with the Three.js Box3 API for convenience.

      Returns KernelBoundingBox | null

      The bounding box with min/max corners and getCenter/getSize helpers, or null if the kernel is empty.

    • Serializes the entire kernel state to a plain JSON-compatible object.

      The format is kernel-specific but must round-trip through fromJSON. Used by SnapshotCommand for undo/redo.

      Returns any

      A JSON-serializable representation of all geometry and topology.