sdf.measure.volume.volume

sdf.measure.volume.volume(
    sdf,
    bounds=(-3, -3, -3),
    size=(6, 6, 6),
    resolution=50,
    epsilon=0.01,
)

Estimate the volume of an SDF as a differentiable JAX scalar.

Uses a smooth sigmoid indicator σ(−d/ε) as a soft approximation of the interior indicator (1 where d < 0, 0 where d > 0). The result is differentiable with respect to any free parameters of the SDF.

Parameters

Name Type Description Default
sdf SDF The SDF to measure. required
bounds tuple[float, float, float] Lower corner (x, y, z) of the sampling box. (-3, -3, -3)
size tuple[float, float, float] Extent (dx, dy, dz) of the sampling box. (6, 6, 6)
resolution int Number of samples per axis (resolution³ total). 50
epsilon float Smoothing width. Smaller → sharper / more accurate; larger → smoother gradients. 0.01

Returns

Name Type Description
Array Differentiable scalar volume estimate.