fit_sphere_3d — 3D geometry op

• 数据种类:points → primitive

• 调用: import fullseye as fs; fs.ledger.fit_sphere_3d(points)(要直接调用实现,import match3d; match3d.fit_sphere_3d(points);从台账取用则 ops3d.get("fit_sphere_3d"))

用法

点群 → 最小二乘球(代数拟合)。返回 (center, radius)。用于管道/球体计量。

以 [2p, 1] 的线性最小二乘(lstsq)求解 |p|² = 2c·p + (r² − |c|²) 的代数拟合(并非最小化几何距离,因此只看到球的一部分或噪声大时半径会有偏差)。(N,3) 不足 4 点则 ValueError。radius 为 sqrt(max(s + |c|², 0)),负值 clamp 为 0。点共面、共线时会静默返回 lstsq 的最小范数解(没有校验。也不返回残差,因此请用 |p − c| − r 确认)。若要按几何距离精修,可将本 op 的结果作为初值做非线性最小二乘;离群值则用 ransac_sphere。从 voxel 检测用 hough_sphere_3d。

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

可运行的示例(实际调用该算子并已验证的样例)

• geometry_metrology — py -3.11 examples_3d/geometry_metrology.py

类型可衔接的下一个算子(可接受 primitive 作为输入)

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

同类别(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 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

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