sdf_subtract — 3D sdf_csg op

Data kinds: sdf × sdfsdf

Call: import fullseye as fs; fs.ledger.sdf_subtract(a, b) (to call the implementation directly, import sdf_ops; sdf_ops.sdf_subtract(a, b); from the registry, ops3d.get("sdf_subtract"))

Usage

The difference A\B = max(a, −b) (inside A and outside B = inside `−b`).

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

`b` の符号反転は「B の外を内、B の内を外」に反転する(相補集合)ので、A との積が

A から B をくり抜いた形になる。非可換: `sdf_subtract(a,b) != sdf_subtract(b,a)`。

計算: `np.maximum(np.asarray(a, float64), -np.asarray(b, float64))`。

`sdf_intersect(a, -b)` と同じ。shape はブロードキャスト整合が必要(不整合なら

numpy の `ValueError)で、それ以外の検査はしない。NaN は伝播、±inf` も

厳密に伝播する(`b = +inf の点は -b = -inf なので a` がそのまま残る =

「B が無限に遠い」点は A のまま)。

入力: 同一グリッド上の 2 つの SDF(内側負・外側正)。`a が残す形、b` が

くり抜く形。距離の単位は入力と同じ。

返り値: ブロードキャスト後の shape の float64。`<= 0` が A\B の占有。

注意:

• B の内側で値は `-b > 0`(B の表面までの距離)になるので、くり抜いた穴の内壁

までの距離は外側では厳密、A の内側では下界(CSG の標準的性質)。

• B が A を完全に含むと全要素が正(空集合)。エラーにはならない。

• 穴あけ・ポケット加工・殻(`asdf_offset(a, -t) の差で厚さ t` の

殻)に使う。

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)

sdf_csgpy -3.11 examples_3d/sdf_csg.py

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

sdf_to_occupancy · fuse_to_voxel · integrate · extract_surface_points · query_distance · sdf_union · sdf_intersect · sdf_smooth_union

Same category (sdf_csg)

grid_coords · sphere_sdf · box_sdf · plane_sdf · cylinder_sdf · torus_sdf · capsule_sdf · sdf_union


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