fit_torus — 3D robust_fit op

• Data kinds: points → primitive

• Call: import fullseye as fs; fs.ledger.fit_torus(points) -> 'dict' (to call the implementation directly, import fit_primitives_ext; fit_primitives_ext.fit_torus(points) -> 'dict'; from the registry, ops3d.get("fit_torus"))

Usage

Fit a torus to a point set and return {center, axis, R, r, residual}.

Minimises the point-torus distance sqrt((ρ−R)² + a²) − r (a = axial component, ρ = radius from the axis, R = major radius, r = tube radius) with scipy.optimize.least_squares. The initial value is the PCA axis (the odd-one-out eigenvector) + R0=mean(ρ) and r0 (the mean distance to the tube-centre circle).

Args:

points: (N,3) point cloud (at least 7 points).

Returns:

dict: {"center": (3,), "axis": (3,), "R": float, "r": float, "residual": float}.

axis is the unit axis, R the major radius, r the tube radius, residual the RMS of point-surface distance.

Raises:

ValueError: fail-closed on bad shape / too few points.

Background guides (the physics and conventions behind this op)

• blas_threads_and_memory — Why matrix decompositions are slow — BLAS threads, caches, memory layout

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)

• fit_primitives_ext — py -3.11 examples_3d/fit_primitives_ext.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 (robust_fit)

ransac_plane · ransac_sphere · ransac_line · ransac_cylinder · fit_cone · fit_ellipsoid


*Provenance: fit_primitives_ext.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.