Skip to content

Commit 9ae7d47

Browse files
committed
Update Python bindings
1 parent a590c44 commit 9ae7d47

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

pysplashsurf/src/pipeline.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fn reconstruction_pipeline_generic<I: Index, R: Real>(
3939
// check_mesh_orientation: bool,
4040
// check_mesh_debug: bool,
4141
mesh_cleanup: bool,
42+
max_rel_snap_dist: Option<R>,
4243
decimate_barnacles: bool,
4344
keep_vertices: bool,
4445
compute_normals: bool,
@@ -93,6 +94,7 @@ fn reconstruction_pipeline_generic<I: Index, R: Real>(
9394
vertex_connectivity = Some(splashsurf_lib::postprocessing::marching_cubes_cleanup(
9495
&mut mesh_with_data.mesh,
9596
reconstruction.grid(),
97+
max_rel_snap_dist,
9698
5,
9799
keep_vertices,
98100
));
@@ -461,9 +463,9 @@ fn attrs_conversion<'py, R: Real + Element>(
461463
#[pyo3(name = "reconstruction_pipeline_f32")]
462464
#[pyo3(signature = (particles, *, attributes_to_interpolate, particle_radius, rest_density,
463465
smoothing_length, cube_size, iso_surface_threshold,
464-
aabb_min = None, aabb_max = None, enable_multi_threading=false,
465-
use_custom_grid_decomposition=false, subdomain_num_cubes_per_dim=64, global_neighborhood_list=false,
466-
mesh_cleanup, decimate_barnacles, keep_vertices, compute_normals, sph_normals,
466+
aabb_min = None, aabb_max = None, enable_multi_threading = false,
467+
use_custom_grid_decomposition = false, subdomain_num_cubes_per_dim = 64, global_neighborhood_list = false,
468+
mesh_cleanup, max_rel_snap_dist = None, decimate_barnacles, keep_vertices, compute_normals, sph_normals,
467469
normals_smoothing_iters, mesh_smoothing_iters, mesh_smoothing_weights,
468470
mesh_smoothing_weights_normalization, output_mesh_smoothing_weights,
469471
output_raw_normals, mesh_aabb_min, mesh_aabb_max, mesh_aabb_clamp_vertices
@@ -483,6 +485,7 @@ pub fn reconstruction_pipeline_py_f32<'py>(
483485
subdomain_num_cubes_per_dim: u32,
484486
global_neighborhood_list: bool,
485487
mesh_cleanup: bool,
488+
max_rel_snap_dist: Option<f32>,
486489
decimate_barnacles: bool,
487490
keep_vertices: bool,
488491
compute_normals: bool,
@@ -519,6 +522,7 @@ pub fn reconstruction_pipeline_py_f32<'py>(
519522
subdomain_num_cubes_per_dim,
520523
global_neighborhood_list,
521524
mesh_cleanup,
525+
max_rel_snap_dist,
522526
decimate_barnacles,
523527
keep_vertices,
524528
compute_normals,
@@ -545,9 +549,9 @@ pub fn reconstruction_pipeline_py_f32<'py>(
545549
#[pyo3(name = "reconstruction_pipeline_f64")]
546550
#[pyo3(signature = (particles, *, attributes_to_interpolate, particle_radius, rest_density,
547551
smoothing_length, cube_size, iso_surface_threshold,
548-
aabb_min = None, aabb_max = None, enable_multi_threading=false,
549-
use_custom_grid_decomposition=false, subdomain_num_cubes_per_dim=64, global_neighborhood_list=false,
550-
mesh_cleanup, decimate_barnacles, keep_vertices, compute_normals, sph_normals,
552+
aabb_min = None, aabb_max = None, enable_multi_threading = false,
553+
use_custom_grid_decomposition = false, subdomain_num_cubes_per_dim = 64, global_neighborhood_list = false,
554+
mesh_cleanup, max_rel_snap_dist = None, decimate_barnacles, keep_vertices, compute_normals, sph_normals,
551555
normals_smoothing_iters, mesh_smoothing_iters, mesh_smoothing_weights,
552556
mesh_smoothing_weights_normalization, output_mesh_smoothing_weights,
553557
output_raw_normals, mesh_aabb_min, mesh_aabb_max, mesh_aabb_clamp_vertices
@@ -567,6 +571,7 @@ pub fn reconstruction_pipeline_py_f64<'py>(
567571
subdomain_num_cubes_per_dim: u32,
568572
global_neighborhood_list: bool,
569573
mesh_cleanup: bool,
574+
max_rel_snap_dist: Option<f64>,
570575
decimate_barnacles: bool,
571576
keep_vertices: bool,
572577
compute_normals: bool,
@@ -603,6 +608,7 @@ pub fn reconstruction_pipeline_py_f64<'py>(
603608
subdomain_num_cubes_per_dim,
604609
global_neighborhood_list,
605610
mesh_cleanup,
611+
max_rel_snap_dist,
606612
decimate_barnacles,
607613
keep_vertices,
608614
compute_normals,

pysplashsurf/src/post_processing.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,28 @@ pub fn decimation_py_f32<'py>(
260260

261261
#[pyfunction]
262262
#[pyo3(name = "marching_cubes_cleanup_f64")]
263-
#[pyo3(signature = (mesh, grid, *, max_iter, keep_vertices))]
263+
#[pyo3(signature = (mesh, grid, *, max_rel_snap_dist = None, max_iter = 5, keep_vertices = false))]
264264
pub fn marching_cubes_cleanup_py_f64<'py>(
265265
py: Python,
266266
mesh: PyObject,
267267
grid: &UniformGridF64,
268+
max_rel_snap_dist: Option<f64>,
268269
max_iter: usize,
269270
keep_vertices: bool,
270271
) -> PyResult<Vec<Vec<usize>>> {
271272
if let Ok(mesh) = mesh.downcast_bound::<TriMesh3dF64>(py) {
272273
Ok(splashsurf_lib::postprocessing::marching_cubes_cleanup(
273274
&mut mesh.borrow_mut().inner,
274275
&grid.inner,
276+
max_rel_snap_dist,
275277
max_iter,
276278
keep_vertices,
277279
))
278280
} else if let Ok(mesh) = mesh.downcast_bound::<TriMeshWithDataF64>(py) {
279281
Ok(splashsurf_lib::postprocessing::marching_cubes_cleanup(
280282
&mut mesh.borrow_mut().inner.mesh,
281283
&grid.inner,
284+
max_rel_snap_dist,
282285
max_iter,
283286
keep_vertices,
284287
))
@@ -289,25 +292,28 @@ pub fn marching_cubes_cleanup_py_f64<'py>(
289292

290293
#[pyfunction]
291294
#[pyo3(name = "marching_cubes_cleanup_f32")]
292-
#[pyo3(signature = (mesh, grid, *, max_iter, keep_vertices))]
295+
#[pyo3(signature = (mesh, grid, *, max_rel_snap_dist = None, max_iter = 5, keep_vertices = false))]
293296
pub fn marching_cubes_cleanup_py_f32<'py>(
294297
py: Python,
295298
mesh: PyObject,
296299
grid: &UniformGridF32,
300+
max_rel_snap_dist: Option<f32>,
297301
max_iter: usize,
298302
keep_vertices: bool,
299303
) -> PyResult<Vec<Vec<usize>>> {
300304
if let Ok(mesh) = mesh.downcast_bound::<TriMesh3dF32>(py) {
301305
Ok(splashsurf_lib::postprocessing::marching_cubes_cleanup(
302306
&mut mesh.borrow_mut().inner,
303307
&grid.inner,
308+
max_rel_snap_dist,
304309
max_iter,
305310
keep_vertices,
306311
))
307312
} else if let Ok(mesh) = mesh.downcast_bound::<TriMeshWithDataF32>(py) {
308313
Ok(splashsurf_lib::postprocessing::marching_cubes_cleanup(
309314
&mut mesh.borrow_mut().inner.mesh,
310315
&grid.inner,
316+
max_rel_snap_dist,
311317
max_iter,
312318
keep_vertices,
313319
))

0 commit comments

Comments
 (0)