Perf/mesh collision (#1307)

Thanks @Ian-cmd-ops.
This commit is contained in:
H. Conrad authored and GitHub committed 2026-10-16 01:12:39 -04:00
1 parent 5e9285ca75
commit d29ca29578
6 files changed
+257 -73

No files matched your search

+3
View File
@@ -25,4 +25,7 @@ spade = { workspace = true }
rayon = { workspace = true }
[dev-dependencies]
# The vendored crate tests never build in CI, so its equivalence checks run from kernel tests.
# Resolver 3 keeps this dev-only feature out of shipped builds.
truck-meshalgo = { workspace = true, features = ["test-hooks"] }
proptest = { version = "1", default-features = false, features = ["std"] }
@@ -0,0 +1,24 @@
//! Equivalence checks for SolidCraft's changes to the vendored truck crates.
//!
//! The vendored crates are outside the workspace, so their own tests never run in CI. Each
//! change that replaces an algorithm keeps the old one behind the crate's `test-hooks` feature
//! (on only for these tests) and these tests check the new one gives the same answers.
use truck_meshalgo::analyzers::collision_test_hooks as collision;
/// Mesh collision candidate search (sweep with per-triangle boxes): same collisions, same order.
#[test]
fn mesh_collision_same_as_before() {
match collision::same_collisions_in_the_same_order(0..200) {
Ok(n) => assert!(n > 0, "the random meshes produced no collisions to compare"),
Err(e) => panic!("{e}"),
}
}
/// NaN coordinates in a mesh: the collision search goes on without a panic.
#[test]
fn mesh_collision_nan_triangles_do_not_panic() {
if let Err(e) = collision::nan_triangles_do_not_panic() {
panic!("{e}");
}
}