Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing either shape from a 2-shape BVH panics #124

Open
finnbear opened this issue Jan 7, 2025 · 0 comments · May be fixed by #129
Open

Removing either shape from a 2-shape BVH panics #124

finnbear opened this issue Jan 7, 2025 · 0 comments · May be fixed by #129

Comments

@finnbear
Copy link
Contributor

finnbear commented Jan 7, 2025

The following code panics but shouldn't:

    #[test]
    fn test_traverse_subtle_bvh() {
        let mut boxes = vec![
            UnitBox::new(0, TPoint3::new(0.0, 0.0, 0.0)),
            UnitBox::new(1, TPoint3::new(5.0, 5.0, 5.0)),
        ];
        let mut bvh = Bvh::build(&mut boxes);
        bvh.remove_shape(&mut boxes, 0, true); // removing 1 also panics
    }
thread 'bvh::distance_traverse::tests::test_traverse_subtle_bvh' panicked at src/bvh/optimization.rs:250:17:
Circular node that wasn't root parent=0 node=1
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/std/src/panicking.rs:681:5
   1: core::panicking::panic_fmt
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/panicking.rs:75:14
   2: bvh::bvh::optimization::<impl bvh::bvh::bvh_impl::Bvh<T,_>>::remove_shape
             at ./src/bvh/optimization.rs:250:17
   3: bvh::bvh::distance_traverse::tests::test_traverse_subtle_bvh
             at ./src/bvh/distance_traverse.rs:386:9
   4: bvh::bvh::distance_traverse::tests::test_traverse_subtle_bvh::{{closure}}
             at ./src/bvh/distance_traverse.rs:380:34
   5: core::ops::function::FnOnce::call_once
             at /home/finnb/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
   6: core::ops::function::FnOnce::call_once
             at /rustc/a4cb3c831823d9baa56c3d90514b75b2660116fa/library/core/src/ops/function.rs:250:5
finnbear added a commit to finnbear/bvh that referenced this issue Jan 8, 2025
@finnbear finnbear linked a pull request Jan 8, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant