cylinder_sdf — 3D sdf_csg op

資料種類:coordgridsdf

呼叫: import fullseye as fs; fs.ledger.cylinder_sdf(grid, center, axis, radius, height)(要直接呼叫實作,import sdf_ops; sdf_ops.cylinder_sdf(grid, center, axis, radius, height);從台帳取用則 ops3d.get("cylinder_sdf"))

用法

> 該運算子的說明尚無譯文,以下照原文給出。

有限長の円柱(両端が平らな蓋)の厳密な符号付き距離場(内側負・外側正)。

軸方向の距離 `t と軸からの半径 r に分け、q = (r - radius, |t| - height/2)`

として `outside = ‖max(q, 0)‖inside = min(max(q), 0)sdf = outside + inside`。

これは `box_sdf` と同じ Quilez 流の構成を「(半径, 軸)の 2-D 断面」に適用したもので、

側面・蓋・角(縁)のいずれに対しても真のユークリッド距離になる。

引数と検証(`ValueError`):

• `grid: 最終軸が 3 の float 配列 (..., 3)`。

• `center`: 円柱の中心(端面ではなく重心。要素数 3)。

• `axis`: 軸の向き(要素数 3、零ベクトル・NaN は拒否。長さは自動正規化)。

• `radius: 半径 > 0 相当のスカラ(0` は軸線そのもの、負は拒否)。

• `height: 全長のスカラ(center` から ±height/2。負は拒否)。

返り値: `grid.shape[:-1]` の float64。

使いどころ: **貫通穴は `sdf_subtract(part, cylinder_sdf(...))**(height` を部品より

長くして端面の縁を残さない)。ボス・ピン・シャフトは `sdf_union`。無限長の円柱が

要るなら `height` を十分大きく取る(端面が評価域の外に出れば側面だけが効く)。

參考(範例資料・文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

可執行的範例(實際呼叫該運算子並已驗證的樣例)

sdf_csgpy -3.11 examples_3d/sdf_csg.py

型別可銜接的下一個運算子(可接受 sdf 作為輸入)

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

同類別(sdf_csg)

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


*Provenance: sdf_ops.py — 3D 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

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