BVH optimize panics when only one shape contained in it
tlaukkan opened this issue · 0 comments
I am getting this error when attempting to optimize with only one shape in the bvh:
attempt to subtract with overflow
thread 'sphere_intersector::tests::test_ray_intersect' panicked at 'attempt to subtract with overflow', /Users/tlaukkan/.cargo/registry/src/github.com-1ecc6299db9ec823/bvh-0.3.2/src/bvh/optimization.rs:144:43
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1063
5: std::io::Write::write_fmt
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/io/mod.rs:1426
6: std::io::impls::<impl std::io::Write for alloc::boxed::Box>::write_fmt
at src/libstd/io/impls.rs:156
7: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
8: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
9: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:204
10: std::panicking::default_hook
at src/libstd/panicking.rs:221
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:470
12: rust_begin_unwind
at src/libstd/panicking.rs:378
13: std::panicking::begin_panic
14: std::panicking::begin_panic
15: bvh::bvh::optimization::::optimize
at /Users/tlaukkan/.cargo/registry/src/github.com-1ecc6299db9ec823/bvh-0.3.2/src/bvh/optimization.rs:144
16: intersect::sphere_intersector::SphereIntersector::optimize
at src/sphere_intersector.rs:111
17: intersect::sphere_intersector::tests::test_ray_intersect
at src/sphere_intersector.rs:192
18: intersect::sphere_intersector::tests::test_ray_intersect::{{closure}}
at src/sphere_intersector.rs:151
19: core::ops::function::FnOnce::call_once
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libcore/ops/function.rs:232
20: <alloc::boxed::Box as core::ops::function::FnOnce>::call_once
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/liballoc/boxed.rs:1017
21: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:86
22: std::panicking::try
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/panicking.rs:281
23: std::panic::catch_unwind
at /rustc/4fb7144ed159f94491249e86d5bbd033b5d60550/src/libstd/panic.rs:394
24: test::run_test_in_process
at src/libtest/lib.rs:542
25: test::run_test::run_test_inner::{{closure}}
at src/libtest/lib.rs:451
note: Some details are omitted, run with RUST_BACKTRACE=full
for a verbose backtrace.