parry icon indicating copy to clipboard operation
parry copied to clipboard

crash mesh_intersection with co-planar triangles

Open ThierryBerger opened this issue 6 months ago • 0 comments

Currently only failing tests, which serves as a discussion starter.

The panic is documented in spade, I think we should sanitize edges parameters sent to https://github.com/dimforge/parry/blob/fd61591cf881436faa3e99385f4947b1b942d9fe/src/transformation/mesh_intersection/mesh_intersection.rs#L466

Backtrace:

thread 'query::gjk::gjk::test::test_mesh_intersection_2' panicked at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/cdt.rs:898:26:
The new constraint edge intersects an existing constraint edge.
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:75:14
   2: core::panicking::panic_display
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/panicking.rs:261:5
   3: core::option::expect_failed
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/option.rs:2024:5
   4: core::option::Option<T>::expect
             at /home/tb/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:933:21
   5: spade::cdt::ConstrainedDelaunayTriangulation<V,DE,UE,F,L>::resolve_splitting_constraint_request
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/cdt.rs:897:38
   6: spade::cdt::ConstrainedDelaunayTriangulation<V,DE,UE,F,L>::add_constraint
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/cdt.rs:551:9
   7: spade::delaunay_core::bulk_load::bulk_load_cdt::{{closure}}
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/delaunay_core/bulk_load.rs:244:21
   8: spade::delaunay_core::bulk_load::bulk_load_cdt
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/delaunay_core/bulk_load.rs:295:13
   9: spade::cdt::ConstrainedDelaunayTriangulation<V,DE,UE,F,L>::bulk_load_cdt_stable::{{closure}}
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/cdt.rs:391:46
  10: spade::delaunay_core::bulk_load::bulk_load_stable
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/delaunay_core/bulk_load.rs:381:28
  11: spade::cdt::ConstrainedDelaunayTriangulation<V,DE,UE,F,L>::bulk_load_cdt_stable
             at /home/tb/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/spade-2.13.1/src/cdt.rs:391:13
  12: triangulate_constraints_and_merge_duplicates
             at ./../../src/transformation/mesh_intersection/mesh_intersection.rs:466:9
  13: parry3d::transformation::mesh_intersection::mesh_intersection::merge_triangle_sets
             at ./../../src/transformation/mesh_intersection/mesh_intersection.rs:640:34
  14: parry3d::transformation::mesh_intersection::mesh_intersection::intersect_meshes_with_tolerances
             at ./../../src/transformation/mesh_intersection/mesh_intersection.rs:254:5
  15: test_mesh_intersection_2
             at ./../../src/query/gjk/gjk.rs:446:26
  16: parry3d::query::gjk::gjk::test::test_mesh_intersection_2::{{closure}}
             at ./../../src/query/gjk/gjk.rs:433:34
  17: core::ops::function::FnOnce::call_once
             at /home/tb/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  18: core::ops::function::FnOnce::call_once
             at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
test query::gjk::gjk::test::test_mesh_intersection_2 ... FAILED

ThierryBerger avatar Jun 19 '25 15:06 ThierryBerger