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

Panic with closest_point on segment vs trimesh #371

Open
ColonelThirtyTwo opened this issue Dec 22, 2020 · 0 comments
Open

Panic with closest_point on segment vs trimesh #371

ColonelThirtyTwo opened this issue Dec 22, 2020 · 0 comments

Comments

@ColonelThirtyTwo
Copy link
Contributor

Reproduction

use ncollide3d::na::{Point3, Vector3};

fn main() {

	let verts = vec![Point3::new(1.0f32, 1.0, 1.0), Point3::new(-1.0, 1.0, 1.0), Point3::new(-1.0, -1.0, 1.0), Point3::new(1.0, 1.0, 1.0), Point3::new(-1.0, -1.0, 1.0), Point3::new(1.0, -1.0, 1.0), Point3::new(1.0, -1.0, -1.0), Point3::new(1.0, -1.0, 1.0), Point3::new(-1.0, -1.0, 1.0), Point3::new(1.0, -1.0, -1.0), Point3::new(-1.0, -1.0, 1.0), Point3::new(-1.0, -1.0, -1.0), Point3::new(-1.0, -1.0, -1.0), Point3::new(-1.0, -1.0, 1.0), Point3::new(-1.0, 1.0, 1.0), Point3::new(-1.0, -1.0, -1.0), Point3::new(-1.0, 1.0, 1.0), Point3::new(-1.0, 1.0, -1.0), Point3::new(-1.0, 1.0, -1.0), Point3::new(1.0, 1.0, -1.0), Point3::new(1.0, -1.0, -1.0), Point3::new(-1.0, 1.0, -1.0), Point3::new(1.0, -1.0, -1.0), Point3::new(-1.0, -1.0, -1.0), Point3::new(1.0, 1.0, -1.0), Point3::new(1.0, 1.0, 1.0), Point3::new(1.0, -1.0, 1.0), Point3::new(1.0, 1.0, -1.0), Point3::new(1.0, -1.0, 1.0), Point3::new(1.0, -1.0, -1.0), Point3::new(-1.0, 1.0, -1.0), Point3::new(-1.0, 1.0, 1.0), Point3::new(1.0, 1.0, 1.0), Point3::new(-1.0, 1.0, -1.0), Point3::new(1.0, 1.0, 1.0), Point3::new(1.0, 1.0, -1.0)];
	let indices = vec![Point3::new(0usize, 1, 2), Point3::new(3, 4, 5), Point3::new(6, 7, 8), Point3::new(9, 10, 11), Point3::new(12, 13, 14), Point3::new(15, 16, 17), Point3::new(18, 19, 20), Point3::new(21, 22, 23), Point3::new(24, 25, 26), Point3::new(27, 28, 29), Point3::new(30, 31, 32), Point3::new(33, 34, 35)];
	let mesh = ncollide3d::shape::TriMesh::new(verts, indices, None);
	
	let ray = ncollide3d::query::Ray { origin: Point3::new(7.2657557, -6.8810306, 4.931747), dir: Vector3::new(-0.8729342, 0.41952112, -0.24897367) };
	
	let closest = ncollide3d::query::closest_points(
		&ncollide3d::na::Isometry3::identity(),
		&ncollide3d::shape::Segment {
			a: ray.origin,
			b: ray.point_at(99999.9),
		},
		&ncollide3d::na::Isometry3::identity(),
		&mesh,
		2.0
	);
	println!("Closest: {:?}" ,closest);
}

Causes a panic:

thread 'main' panicked at 'The composite shape must not be empty.', /home/col/.cargo/registry/src/github.com-1ecc6299db9ec823/ncollide3d-0.26.1/src/query/closest_points/closest_points_composite_shape_shape.rs:24:10
stack backtrace:
   0:     0x561764860df0 - std::backtrace_rs::backtrace::libunwind::trace::h72c2fb8038f1bbee
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x561764860df0 - std::backtrace_rs::backtrace::trace_unsynchronized::h1e3b084883f1e78c
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x561764860df0 - std::sys_common::backtrace::_print_fmt::h3bf6a7ebf7f0394a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:79
   3:     0x561764860df0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2e8cb764b7fe02e7
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:58
   4:     0x56176487e00c - core::fmt::write::h7a1184eaee6a8644
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/fmt/mod.rs:1080
   5:     0x56176485efe2 - std::io::Write::write_fmt::haeeb374d93a67eac
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/io/mod.rs:1516
   6:     0x561764862e7d - std::sys_common::backtrace::_print::h1d14a7f6ad632dc8
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:61
   7:     0x561764862e7d - std::sys_common::backtrace::print::h301abac8bb2e3e81
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:48
   8:     0x561764862e7d - std::panicking::default_hook::{{closure}}::hde0cb80358a6920a
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:208
   9:     0x561764862b28 - std::panicking::default_hook::h9b1a691049a0ec8f
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:227
  10:     0x561764863501 - std::panicking::rust_panic_with_hook::h2bdec87b60580584
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:577
  11:     0x5617648630a9 - std::panicking::begin_panic_handler::{{closure}}::h101ca09d9df5db47
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:484
  12:     0x56176486125c - std::sys_common::backtrace::__rust_end_short_backtrace::h3bb85654c20113ca
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/sys_common/backtrace.rs:153
  13:     0x561764863069 - rust_begin_unwind
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
  14:     0x56176487bee1 - core::panicking::panic_fmt::h48c31e1e3d550146
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
  15:     0x56176487bc73 - core::option::expect_failed::hf3f43f1792267e24
                               at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1226
  16:     0x561764807a8f - core::option::Option<T>::expect::h7e919d77919eca17
                               at /home/col/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:346
  17:     0x5617647ff62b - ncollide3d::query::closest_points::closest_points_composite_shape_shape::closest_points_composite_shape_shape::h3089a621794318cc
                               at /home/col/.cargo/registry/src/github.com-1ecc6299db9ec823/ncollide3d-0.26.1/src/query/closest_points/closest_points_composite_shape_shape.rs:22
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

No branches or pull requests

1 participant