Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...
    • Apply the shared "fit camera to a bounding box" math:

      • Set the controls' scene scale from the box diagonal.
      • For perspective cameras: compute the FOV/aspect-aware distance, position the camera at lookAtTarget + (0, 0, distance), and set distance limits to ZOOM_IN_FACTOR in / ZOOM_OUT_FACTOR out.
      • For orthographic cameras: compute the zoom that fits the largest X/Y extent into the shorter frustum axis (falling back to Z when both are degenerate), position the camera at lookAtTarget + (0, 0, diagonal), and set zoom limits to ZOOM_IN_FACTOR in / ZOOM_OUT_FACTOR out.
      • Run lookAt(lookAtTarget) → updateMatrixWorld(true) → controls.setTarget(...) → controls.reinitialize() → controls.update() → controls.saveState() so the orbit state is consistent with the new pose.

      Returns the diagonal of the bounding box (used by the caller for downstream logging or empty-bounds detection); returns 0 when the box is empty or has zero extent.

      Parameters

      Returns number