torus_sdf — 3D sdf_csg op

• Data kinds: coordgrid → sdf

• Call: import fullseye as fs; fs.ledger.torus_sdf(grid, center, axis, major_radius, minor_radius) (to call the implementation directly, import sdf_ops; sdf_ops.torus_sdf(grid, center, axis, major_radius, minor_radius); from the registry, ops3d.get("torus_sdf"))

Usage

Exact signed distance field of a torus (doughnut) (negative inside, positive outside).

sdf(p) = ‖(r - major_radius, t)‖ - minor_radius (r is the radius from the axis, t the axial distance). The core line is a circle of radius major_radius with a tube of radius minor_radius around it, so it can be used directly as the analytic form of a fillet (rounding of an inner corner).

Arguments and validation (ValueError):

• grid / center / axis: same as cylinder_sdf (the axis is the direction of the donut hole).

• major_radius: radius of the core line (negative is rejected).

• minor_radius: radius of the tube (negative is rejected). With minor_radius >= major_radius the hole collapses (spindle torus). It is not rejected, but it is exact only when minor_radius < major_radius (corrected 2026-10-07: previously this said "correct as a distance field"). Inside, where the tube overlaps itself on the axis, the absolute value is smaller than the true distance to the boundary (major 1, minor 2:

at the center −1, ground truth −1.73). The sign, the zero isosurface and the outside values are correct, and the inside absolute value is a lower bound

of the true distance, so it is safe for sphere tracing.

Returns: float64 of shape grid.shape[:-1].

Where to use: carve a fillet into an inner corner with sdf_subtract / build the shape of an O-ring groove with sdf_union. For merely rounding corners sdf_smooth_union is handier, but there the rounding radius depends on the shape -- use this one when you want the radius as a design value.

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_csg — py -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_subtract

Same category (sdf_csg)

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


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