"""Minimal integration example for software developers. This script shows the *only* code path a production caller needs: load a clean, registered point cloud → call the API → use the result Run:: python examples/integrate_minimal.py path/to/scan.ply """ from __future__ import annotations import logging import sys from pathlib import Path from coupler_panel import ( CouplerError, compute_coupler_measurement, load_point_cloud, ) def main(input_path: Path) -> int: logging.basicConfig(level=logging.INFO, format="%(levelname)s %(name)s: %(message)s") log = logging.getLogger("integrate_minimal") points = load_point_cloud(input_path) log.info("loaded %d points from %s", points.shape[0], input_path) try: result = compute_coupler_measurement( points, progress=lambda s, f: log.info("[%5.1f%%] %s", f * 100, s), ) except CouplerError as exc: log.error("measurement failed: %s", exc) return 2 print(f"theta_right_deg = {result.theta_right_deg:+.4f}") print(f"theta_ref_deg = {result.theta_ref_deg:+.4f}") print(f"D_y_max_mm = {result.D_y_max_mm:.3f}") print(f"D_z_max_mm = {result.D_z_max_mm:.3f}") print(f"dx_y_max_mm = {result.dx_y_max_mm:.3f}") print(f"dx_z_max_mm = {result.dx_z_max_mm:.3f}") print(f"center_C = {tuple(round(c, 3) for c in result.center_C)}") print(f"normal = {tuple(round(c, 6) for c in result.normal)}") print(f"quality_flags = {result.quality_flags}") return 0 if __name__ == "__main__": if len(sys.argv) != 2: print(__doc__.strip()) sys.exit(1) sys.exit(main(Path(sys.argv[1])))