brepjs API Reference
    Preparing search index...

    Function createDistanceQuery

    • Create a reusable distance query from a reference shape.

      Keeps the reference shape loaded in the OCCT distance tool so that multiple distanceTo calls avoid re-loading overhead.

      Parameters

      • referenceShape: AnyShape

        The shape to measure distances from.

      Returns { dispose: () => void; distanceTo: (other: AnyShape) => number }

      An object with distanceTo(other) and dispose() methods.

      Call dispose() when done to free the WASM-allocated distance tool.

      const query = createDistanceQuery(referenceBox);
      const d1 = query.distanceTo(otherBox);
      const d2 = query.distanceTo(sphere);
      query.dispose();