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,
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 (seeswept_volume_mesh()) yields the motion envelope. WithSweptVolumeSignMode.NO_SIGNthe 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.Meshobjects.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.array2dofwarp.transformwith shape(num_meshes, num_samples), or an array of shape(num_meshes, num_samples, 7)(translationxyzfollowed by quaternionxyzw).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 orvoxel_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 inwarp.geometry.IsoSurfaceMarchingCubes.extract(). Defaults to the swept bounds padded so the surface is not clipped. Pass both corners or neither; seeswept_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 withsupport_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)wherefieldis awarp.array3d(dtype=warp.float32)of signed distances, andlowerandupperare thewarp.vec3world coordinates that grid nodes(0, 0, 0)and(nx-1, ny-1, nz-1)map to.- Return type: