diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-13 18:40:59 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-13 18:41:11 +0200 |
| commit | faf3e7e0f7f2b528da99343f9a3f8ce2b8fa6876 (patch) | |
| tree | 3be142fb36db84e82e7c17f72b66cc3931dfdbdd /src/geometry/contact.rs | |
| parent | 8ee3c703d666785207c7db47e3881f2ca9723105 (diff) | |
| download | rapier-faf3e7e0f7f2b528da99343f9a3f8ce2b8fa6876.tar.gz rapier-faf3e7e0f7f2b528da99343f9a3f8ce2b8fa6876.tar.bz2 rapier-faf3e7e0f7f2b528da99343f9a3f8ce2b8fa6876.zip | |
Implement a special case for edge-edge 3D polygonal clipping.
Diffstat (limited to 'src/geometry/contact.rs')
| -rw-r--r-- | src/geometry/contact.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/geometry/contact.rs b/src/geometry/contact.rs index 7e235c2..782175a 100644 --- a/src/geometry/contact.rs +++ b/src/geometry/contact.rs @@ -429,7 +429,7 @@ impl ContactManifold { } #[inline] - pub(crate) fn try_update_contacts(&mut self, pos12: &Isometry<f32>) -> bool { + pub(crate) fn try_update_contacts(&mut self, pos12: &Isometry<f32>, early_stop: bool) -> bool { if self.points.len() == 0 { return false; } @@ -439,7 +439,7 @@ impl ContactManifold { let local_n2 = pos12 * self.local_n2; - if -self.local_n1.dot(&local_n2) < DOT_THRESHOLD { + if early_stop && -self.local_n1.dot(&local_n2) < DOT_THRESHOLD { return false; } @@ -448,7 +448,7 @@ impl ContactManifold { let dpt = local_p2 - pt.local_p1; let dist = dpt.dot(&self.local_n1); - if dist * pt.dist < 0.0 { + if early_stop && dist * pt.dist < 0.0 { // We switched between penetrating/non-penetrating. // The may result in other contacts to appear. return false; @@ -456,7 +456,7 @@ impl ContactManifold { let new_local_p1 = local_p2 - self.local_n1 * dist; let dist_threshold = 0.001; // FIXME: this should not be hard-coded. - if na::distance_squared(&pt.local_p1, &new_local_p1) > dist_threshold { + if early_stop && na::distance_squared(&pt.local_p1, &new_local_p1) > dist_threshold { return false; } |
