From 8e432b298bd71df7d1b776b77c15713d9bea280e Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 6 Oct 2020 10:46:59 +0200 Subject: Make the WQuadTree more generic and use it as the trimesh acceleration structure. --- .../proximity_detector/trimesh_shape_proximity_detector.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/geometry/proximity_detector') diff --git a/src/geometry/proximity_detector/trimesh_shape_proximity_detector.rs b/src/geometry/proximity_detector/trimesh_shape_proximity_detector.rs index 3dd7381..0a3ff44 100644 --- a/src/geometry/proximity_detector/trimesh_shape_proximity_detector.rs +++ b/src/geometry/proximity_detector/trimesh_shape_proximity_detector.rs @@ -5,7 +5,7 @@ use crate::geometry::{Collider, Proximity, Shape, Trimesh, WAABBHierarchyInterse use crate::ncollide::bounding_volume::{BoundingVolume, AABB}; pub struct TrimeshShapeProximityDetectorWorkspace { - interferences: WAABBHierarchyIntersections, + interferences: Vec, local_aabb2: AABB, old_interferences: Vec, } @@ -13,7 +13,7 @@ pub struct TrimeshShapeProximityDetectorWorkspace { impl TrimeshShapeProximityDetectorWorkspace { pub fn new() -> Self { Self { - interferences: WAABBHierarchyIntersections::new(), + interferences: Vec::new(), local_aabb2: AABB::new_invalid(), old_interferences: Vec::new(), } @@ -67,19 +67,17 @@ fn do_detect_proximity( let local_aabb2 = new_local_aabb2; // .loosened(ctxt.prediction_distance * 2.0); // FIXME: what would be the best value? std::mem::swap( &mut workspace.old_interferences, - &mut workspace.interferences.computed_interferences_mut(), + &mut workspace.interferences, ); - trimesh1 - .waabbs() - .compute_interferences_with(local_aabb2, &mut workspace.interferences); + workspace.interferences = trimesh1.waabbs().intersect_aabb(&local_aabb2); workspace.local_aabb2 = local_aabb2; } /* * Dispatch to the specific solver by keeping the previous manifold if we already had one. */ - let new_interferences = workspace.interferences.computed_interferences(); + let new_interferences = &workspace.interferences; let mut old_inter_it = workspace.old_interferences.drain(..).peekable(); let mut best_proximity = Proximity::Disjoint; -- cgit