newton.geometry.extract_particle_surface#
- newton.geometry.extract_particle_surface(positions, radii, voxel_size, *, max_grid_cells=None, kernel_radius=None, threshold=0.25, smooth_lambda=0.5, mesh_smooth_iterations=0, compute_normals=True, anisotropic=False, field_mode=None, redistance_iterations=0, particle_flags=None, particle_world=None, world_count=1, anisotropy_ratio=4.0, kernel_scale=0.5, anisotropy_scale=1.0, anisotropy_min_neighbors=25, anisotropy_binning=False, anisotropy_strength=1.0, field_smooth_iterations=0, field_smooth_radius=1, surface_method='density', particle_sdf_radius_scale=1.0, particle_sdf_band=2.0)[source]#
Extract a triangle mesh from particle positions (one-shot convenience).
- Parameters:
positions (wp.array[wp.vec3f]) – Particle positions [m], shape
(N,), dtypewp.vec3.radii (wp.array[wp.float32]) – Per-particle radii [m], shape
(N,), dtypewp.float32.voxel_size (float) – Edge length of each grid voxel [m].
max_grid_cells (int | None) – Maximum active sparse-grid cell count across all worlds. When set, extraction uses graph-capturable preallocated buffers. When
None, it uses tight sparse allocations. Rebuildable topology-node capacities assume spatially coherent surface bands; highly scattered fields can exhaust them before reaching this cell count.kernel_radius (float | None) – Search radius [m]. Defaults to
3 * voxel_size.threshold (float) – Isosurface level.
smooth_lambda (float) – Position smoothing blend factor [0, 1].
mesh_smooth_iterations (int) – Laplacian mesh smoothing passes.
compute_normals (bool) – Whether to compute per-vertex normals.
anisotropic (bool) – Enable per-particle WPCA anisotropic kernels.
field_mode (Literal['density', 'sdf'] | None) – Field representation retained after extraction. Defaults to
"sdf"forsurface_method="particle_sdf"and"density"otherwise.redistance_iterations (int) – Number of Eikonal redistancing iterations applied when
field_mode="sdf".particle_flags (wp.array[wp.int32] | None) – Optional per-particle flags. Particles without
ACTIVEare skipped.particle_world (wp.array[wp.int32] | None) – Optional world index per particle.
world_count (int) – Number of independent particle worlds to extract.
anisotropy_ratio (float) – Maximum anisotropic kernel axis ratio.
kernel_scale (float) – Kernel radius multiplier relative to
kernel_radius.anisotropy_scale (float) – Relative multiplier for anisotropic kernel radii.
anisotropy_min_neighbors (int) – Minimum number of other particles required for anisotropic kernels.
anisotropy_binning (bool) – Share one WPCA kernel among particles in each spatial bin. Bins are half the kernel radius wide. This reduces neighbor-query cost at the expense of spatial resolution.
anisotropy_strength (float) – Blend from isotropic kernels to anisotropic kernels [0, 1].
field_smooth_iterations (int) – Number of separable Gaussian blur passes applied to the scalar field before marching cubes.
field_smooth_radius (int) – Half-width of the Gaussian blur in voxels.
surface_method (Literal['density', 'particle_sdf']) – Surface reconstruction method.
"density"uses anisotropic density splatting."particle_sdf"directly unions per-particle anisotropic ellipsoid SDFs.particle_sdf_radius_scale (float) – Radius multiplier for
surface_method="particle_sdf".particle_sdf_band (float) – Narrow-band half-width in normalized ellipsoid coordinates for
surface_method="particle_sdf". Must be at least 1 so the band contains the zero level set.
- Returns:
Mesh buffers and device-resident logical counts.
- Return type: