warp.geometry.swept_volume_field#

warp.geometry.swept_volume_field(
meshes,
transforms,
voxel_size=None,
*,
resolution=None,
lower=None,
upper=None,
sign_mode=SweptVolumeSignMode.WINDING_NUMBER,
device=None,
)[source]#

Compute a dense regular-grid discretization of the swept-volume pseudo signed-distance function.

Every node is evaluated by swept_volume_sdf(), by brute force over every (mesh, sample) pair (“dense time stamping”). The result is negative inside the swept volume and positive outside, so extracting its zero isosurface (see swept_volume_mesh()) yields the motion envelope. With SweptVolumeSignMode.NO_SIGN the field is unsigned and therefore positive everywhere. Autodiff is not supported: the kernels that build the field run forward only.

Because the poses are the provided samples, the field only accounts for the geometry at those instants; motion between consecutive samples is not conservatively bounded. Supply a sufficiently fine time sampling for the desired tolerance.

Parameters:
  • meshes (Sequence[warp.Mesh]) – Sequence of rest-pose warp.Mesh objects.

  • transforms (warp.array2d[warp.transform] | npt.ArrayLike) – Per-mesh, per-sample rigid poses, each mapping its mesh from rest space to world space, with a rotation quaternion of unit length. Either a warp.array2d of warp.transform with shape (num_meshes, num_samples), or an array of shape (num_meshes, num_samples, 7) (translation xyz followed by quaternion xyzw).

  • voxel_size (float | None) – Edge length of a grid cell in world units. The domain is grown to a whole number of cells, so the spacing is exactly this on every axis. Cannot be combined with explicit domain bounds.

  • resolution (tuple[int, int, int] | None) – Node counts (nx, ny, nz). Pass this or voxel_size, not both. The spacing follows from the extent, so it is anisotropic unless the node counts match the domain’s aspect ratio.

  • lower (warp.vec3 | tuple[float, float, float] | None) – World coordinate that node (0, 0, 0) maps to, as in warp.geometry.IsoSurfaceMarchingCubes.extract(). Defaults to the swept bounds padded so the surface is not clipped. Pass both corners or neither; see swept_volume_bounds() to size a domain that several fields share.

  • upper (warp.vec3 | tuple[float, float, float] | None) – World coordinate that node (nx-1, ny-1, nz-1) maps to.

  • sign_mode (SweptVolumeSignMode) – Inside/outside classification method; see SweptVolumeSignMode. The default (SweptVolumeSignMode.WINDING_NUMBER) requires every mesh to be built with support_winding_number=True.

  • device (DeviceLike | None) – Device on which to build the field. Defaults to the device of the first mesh.

Returns:

A tuple (field, lower, upper) where field is a warp.array3d(dtype=warp.float32) of signed distances, and lower and upper are the warp.vec3 world coordinates that grid nodes (0, 0, 0) and (nx-1, ny-1, nz-1) map to.

Return type:

tuple[wp.array3d[wp.float32], wp.vec3, wp.vec3]