fit_poly_surface — 3D surface_fit op

Data kinds: image2d × image2d × image2dpoly_surface

Call: import fullseye as fs; fs.ledger.fit_poly_surface(x, y, z, degree=2) (to call the implementation directly, import match3d; match3d.fit_poly_surface(x, y, z, degree=2); from the registry, ops3d.get("fit_poly_surface"))

Usage

Scattered (x,y,z) → a polynomial least-squares z=f(x,y). Returns model (coef/powers/degree/rms/pv).

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

基底 `{x^i·y^j : i + j <= degree}(項数 (degree+1)(degree+2)/2`。degree=1 で 3 項の平面、

2 で 6 項の 2 次曲面)を `lstsq で当てる。x, y, z` は同じ要素数なら形は問わない(内部で

ravel。格子なら `np.mgrid` の出力をそのまま)。

返り値 dict: `coef (T,) 係数、powers は各係数の (i, j)(項 x**i * y**j`)、

`degreerms は残差 RMS、pv` は残差の peak-to-valley(max − min)。単位は z。

• 点数が項数より少ないと最小ノルム解が黙って返る。x, y の桁が大きいと高次で条件が悪くなる

(座標を中心化・正規化してから)。NaN の検証は無い。

後段: `eval_poly_surface(model, x, y) で任意点を評価。格子の高さ場なら surface_form_error`

/ `background_flatten` がこれを内部で呼ぶ。

Background guides (the physics and conventions behind this op)

blas_threads_and_memory — 行列分解が遅い理由の知識 — BLAS スレッド・キャッシュ・メモリ配置

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)

contours_to_terrainpy -3.11 examples_3d/contours_to_terrain.py

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

fuse_to_voxel · eval_poly_surface

Same category (surface_fit)

eval_poly_surface · surface_form_error · background_flatten


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