splat-transform API Reference - v1.10.1
    Preparing search index...

    Function simplifyForCapsule

    • Simplify voxel collision data for upright capsule navigation.

      Uses bitfield storage (1 bit per voxel) to reduce memory by 8x compared to byte-per-voxel. Two Uint32Array buffers are ping-ponged through the dilation, BFS, inversion, and erosion phases.

      Algorithm:

      1. Build dense bitfield grid from the accumulator.
      2. Dilate solid by the capsule shape (Minkowski sum) to get the clearance grid -- cells where the capsule center cannot be placed.
      3. BFS flood fill from the seed through free (non-blocked) cells to find all reachable capsule-center positions (uses a separate visited bitfield).
      4. Invert: every non-reachable cell becomes solid (negative space carving), computed as a single bitwise operation per word.
      5. Erode the solid by the capsule shape (Minkowski subtraction) to shrink surfaces back to their original positions, undoing the inflation from step 2 so the runtime capsule query produces correct collisions.
      6. Crop to bounding box of navigable cells.

      The flood fill is bounded by the finite grid extents: out-of-bounds cells are never visited, but grid boundaries are not explicitly modeled as solid. This means unsealed scenes may allow navigation up to the edge of the grid.

      Parameters

      • accumulator: BlockAccumulator

        BlockAccumulator with filtered voxelization results.

      • gridBounds: Bounds

        Grid bounds aligned to block boundaries (not mutated).

      • voxelResolution: number

        Size of each voxel in world units.

      • capsuleHeight: number

        Total capsule height in world units.

      • capsuleRadius: number

        Capsule radius in world units.

      • seed: NavSeed

        Seed position in world space (must be in a free region).

      Returns NavSimplifyResult

      Simplified accumulator and cropped grid bounds.