fit_line_3d — 3D geometry op

Data kinds: pointsprimitive

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

Usage

Point set → a least-squares line (through the centroid, direction = the largest principal axis). Returns (point, direction).

> The detailed description below is the original text — the summary and the headings are translated.

`(N,3) の点群(数値・列数 3 でなければ ValueError、2 点未満も ValueError)の重心 c` と

散布行列 `(P−c)ᵀ(P−c)` の最大固有値の固有ベクトルを返す(直交距離の二乗和を最小化する直線。

z=f(x) 型の回帰ではない)。`direction は単位ベクトルで **符号は任意**(eigh` 次第。向きを

揃えるなら `(P[-1] − P[0]) @ direction` の符号で反転)。

2 点だけなら 2 点を通る直線。点が平面状に広がっていると最大軸は「最も長い方向」になるだけで

直線とは限らない(残差は返さないので `distance_point_line` で確かめる)。外れ値に弱い

(ロバストには `ransac_line`)。3-D 専用(2-D 点は ValueError)。

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_metrologypy -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.