capsule_sdf — 3D sdf_csg op

• 数据种类:coordgrid → sdf

• 调用: import fullseye as fs; fs.ledger.capsule_sdf(grid, a, b, radius)(要直接调用实现,import sdf_ops; sdf_ops.capsule_sdf(grid, a, b, radius);从台账取用则 ops3d.get("capsule_sdf"))

用法

将线段 a–b 以半径 radius 加粗所得胶囊体的精确有符号距离场。

sdf(p) = ‖p - (a + clamp(((p-a)·(b-a))/‖b-a‖², 0, 1)·(b-a))‖ - radius。它就是到线段的最短距离,因此在全空间梯度范数为 1(与圆柱不同,端部是圆的,没有角,因而严格)。适合近似加强筋、管道、骨骼、线材、工具的扫掠体积。

参数与校验(ValueError):

• grid:最后一轴为 3 的 float 数组 (..., 3)。

• a / b:芯线的端点(元素数 3)。a == b 时为球(与 sphere_sdf 一致)。

• radius:粗细(拒绝负值)。

返回值:grid.shape[:-1] 的 float64。

用法:以“工具的扫掠体积是否与零件相交”来判断工具可达性时,将工具放置为胶囊体,看 sdf_intersect 的最小值是否为正。也可用于合成骨小梁、血管、纤维。

参考(示例数据、文献)

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

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

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

• procedural_hand — py -3.11 examples_3d/procedural_hand.py

• sdf_csg — py -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 · cylinder_sdf · torus_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.