fit_sphere_3d — 3D geometry op

• Data kinds: points → primitive

• Call: import fullseye as fs; fs.ledger.fit_sphere_3d(points) (to call the implementation directly, import match3d; match3d.fit_sphere_3d(points); from the registry, ops3d.get("fit_sphere_3d"))

Usage

Point set → a least-squares sphere (algebraic fit). Returns (center, radius). For pipe and ball metrology.

An algebraic fit that solves |p|² = 2c·p + (r² − |c|²) by linear least squares (lstsq) on [2p, 1] (it does not minimise the geometric distance, so the radius is biased when only part of the sphere is visible or the noise is large). For (N,3) with fewer than 4 points, ValueError. radius is sqrt(max(s + |c|², 0)), with negatives clamped to 0. If the points are coplanar or collinear, the minimum-norm solution of lstsq is returned silently (no validation; no residual is returned either, so check with |p − c| − r). To refine by geometric distance, use this op's result as the initial value for non-linear least squares; for outliers use ransac_sphere. For detection from voxels, hough_sphere_3d.

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

Runnable examples (verified samples that actually call this op)

• geometry_metrology — py -3.11 examples_3d/geometry_metrology.py

Ops the type connects to (they accept primitive as input)

fuse_to_voxel · angle_between_lines · angle_between_planes · angle_line_plane · distance_point_plane · distance_point_line · distance_line_line · distance_segment_segment

Same category (geometry)

line_from_2points · plane_from_3points · angle_3points · angle_between_lines · angle_between_planes · angle_line_plane · distance_point_plane · distance_point_line


*Provenance: match3d.py — 3D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.