brepjs API Reference
    Preparing search index...

    Interface VoxelEngine

    The wasm surface the voxel domain depends on — structurally satisfied by the loaded brepjs-voxel-wasm module. Kept snake_case to match the wasm-bindgen exports exactly, so the raw module is a zero-adapter VoxelEngine.

    All buffers are flat (no zero-copy across the wasm boundary, per ADR-0013): verts is xyz·V, tris is index·T, queries is xyz·Q.

    interface VoxelEngine {
        ScalarField: WasmScalarFieldConstructor;
        Sdf: WasmSdfConstructor;
        VoxelField: WasmVoxelFieldConstructor;
        lattice_infill(
            verts: Float32Array,
            tris: Uint32Array,
            resolution: number,
            padding: number,
            lattice_type: number,
            period: number,
            thickness: number,
        ): VoxelRepairResult;
        offset_mesh(
            verts: Float32Array,
            tris: Uint32Array,
            distance: number,
            resolution: number,
            padding: number,
        ): VoxelRepairResult;
        points_inside(
            verts: Float32Array,
            tris: Uint32Array,
            queries: Float32Array,
        ): Uint8Array;
        repair_mesh(
            verts: Float32Array,
            tris: Uint32Array,
            resolution: number,
            padding: number,
        ): VoxelRepairResult;
        shell_mesh(
            verts: Float32Array,
            tris: Uint32Array,
            thickness: number,
            resolution: number,
            padding: number,
        ): VoxelRepairResult;
        tpms_box(
            min_x: number,
            min_y: number,
            min_z: number,
            max_x: number,
            max_y: number,
            max_z: number,
            resolution: number,
            padding: number,
            lattice_type: number,
            period: number,
            thickness: number,
        ): VoxelRepairResult;
        version(): string;
        voxel_boolean(
            verts_a: Float32Array,
            tris_a: Uint32Array,
            verts_b: Float32Array,
            tris_b: Uint32Array,
            op: number,
            resolution: number,
            padding: number,
        ): VoxelRepairResult;
        winding_numbers(
            verts: Float32Array,
            tris: Uint32Array,
            queries: Float32Array,
        ): Float32Array;
    }
    Index

    Properties

    ScalarField: WasmScalarFieldConstructor

    Position-varying scalar fields (brepjs-implicit Phase 2b). Static constructors compose an opaque field that the Sdf modulated operators sample per voxel. Structurally satisfied by the generated ScalarField wasm-bindgen class.

    Sdf: WasmSdfConstructor

    Field-first analytic SDF builder (ADR-0013). Static primitive constructors and combinator methods compose an opaque expression tree that rasterizes directly into a WasmVoxelField with no input mesh. Structurally satisfied by the generated Sdf wasm-bindgen class.

    VoxelField: WasmVoxelFieldConstructor

    Persistent dense voxel-field class, for same-grid op chains: voxelize a mesh once, then boolean/offset/shell/reinit in place, contour once. Structurally satisfied by the generated VoxelField wasm-bindgen class.

    Methods

    • Fill an FWN-signed solid with a TPMS lattice infill, contoured to a mesh.

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • resolution: number
      • padding: number
      • lattice_type: number
      • period: number
      • thickness: number

      Returns VoxelRepairResult

    • Offset a mesh by a true-SDF iso-level shift (>0 outward, <0 inward).

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • distance: number
      • resolution: number
      • padding: number

      Returns VoxelRepairResult

    • Inside/outside classification per query point (1 = inside, 0 = outside).

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • queries: Float32Array

      Returns Uint8Array

    • Voxelize-and-contour a mesh into a closed surface (FWN sign keystone).

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • resolution: number
      • padding: number

      Returns VoxelRepairResult

    • Hollow a solid mesh into an inward shell of the given thickness (>0).

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • thickness: number
      • resolution: number
      • padding: number

      Returns VoxelRepairResult

    • Contour the infinite TPMS lattice clipped to an axis-aligned box.

      Parameters

      • min_x: number
      • min_y: number
      • min_z: number
      • max_x: number
      • max_y: number
      • max_z: number
      • resolution: number
      • padding: number
      • lattice_type: number
      • period: number
      • thickness: number

      Returns VoxelRepairResult

    • Engine artifact version, for loader/artifact compatibility checks.

      Returns string

    • Voxel CSG of two meshes (op: 0=union, 1=intersection, 2=difference A−B).

      Parameters

      • verts_a: Float32Array
      • tris_a: Uint32Array
      • verts_b: Float32Array
      • tris_b: Uint32Array
      • op: number
      • resolution: number
      • padding: number

      Returns VoxelRepairResult

    • Generalized winding number per query point (~1 inside, ~0 outside).

      Parameters

      • verts: Float32Array
      • tris: Uint32Array
      • queries: Float32Array

      Returns Float32Array