diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-02-21 21:34:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-21 21:34:30 +0100 |
| commit | a3190846b7fb5214ccd4a12a2f5e8150e323df12 (patch) | |
| tree | 2037da67d547490565e9720f7c3b3337026c5f8c /src/dynamics/solver/velocity_ground_constraint_element.rs | |
| parent | ce3cf553c27d3fad6302dff7d196fccb953c2c33 (diff) | |
| parent | 15b165893c718a5606622b05b36f8041a429e30c (diff) | |
| download | rapier-a3190846b7fb5214ccd4a12a2f5e8150e323df12.tar.gz rapier-a3190846b7fb5214ccd4a12a2f5e8150e323df12.tar.bz2 rapier-a3190846b7fb5214ccd4a12a2f5e8150e323df12.zip | |
Merge pull request #290 from dimforge/solver-nan
Fix potential inf/NaN by using an epsilon for inv/simd_inv
Diffstat (limited to 'src/dynamics/solver/velocity_ground_constraint_element.rs')
| -rw-r--r-- | src/dynamics/solver/velocity_ground_constraint_element.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/dynamics/solver/velocity_ground_constraint_element.rs b/src/dynamics/solver/velocity_ground_constraint_element.rs index 8057030..06a727a 100644 --- a/src/dynamics/solver/velocity_ground_constraint_element.rs +++ b/src/dynamics/solver/velocity_ground_constraint_element.rs @@ -1,10 +1,9 @@ use super::DeltaVel; use crate::math::{AngVector, Vector, DIM}; -use crate::utils::{WBasis, WDot}; -use na::SimdRealField; +use crate::utils::{WBasis, WDot, WReal}; #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintTangentPart<N: SimdRealField + Copy> { +pub(crate) struct VelocityGroundConstraintTangentPart<N: WReal> { pub gcross2: [AngVector<N>; DIM - 1], pub rhs: [N; DIM - 1], #[cfg(feature = "dim2")] @@ -17,7 +16,7 @@ pub(crate) struct VelocityGroundConstraintTangentPart<N: SimdRealField + Copy> { pub r: [N; DIM], } -impl<N: SimdRealField + Copy> VelocityGroundConstraintTangentPart<N> { +impl<N: WReal> VelocityGroundConstraintTangentPart<N> { fn zero() -> Self { Self { gcross2: [na::zero(); DIM - 1], @@ -39,7 +38,6 @@ impl<N: SimdRealField + Copy> VelocityGroundConstraintTangentPart<N> { mj_lambda2: &mut DeltaVel<N>, ) where AngVector<N>: WDot<AngVector<N>, Result = N>, - N::Element: SimdRealField + Copy, { #[cfg(feature = "dim2")] { @@ -89,7 +87,7 @@ impl<N: SimdRealField + Copy> VelocityGroundConstraintTangentPart<N> { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintNormalPart<N: SimdRealField + Copy> { +pub(crate) struct VelocityGroundConstraintNormalPart<N: WReal> { pub gcross2: AngVector<N>, pub rhs: N, pub rhs_wo_bias: N, @@ -97,7 +95,7 @@ pub(crate) struct VelocityGroundConstraintNormalPart<N: SimdRealField + Copy> { pub r: N, } -impl<N: SimdRealField + Copy> VelocityGroundConstraintNormalPart<N> { +impl<N: WReal> VelocityGroundConstraintNormalPart<N> { fn zero() -> Self { Self { gcross2: na::zero(), @@ -129,12 +127,12 @@ impl<N: SimdRealField + Copy> VelocityGroundConstraintNormalPart<N> { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintElement<N: SimdRealField + Copy> { +pub(crate) struct VelocityGroundConstraintElement<N: WReal> { pub normal_part: VelocityGroundConstraintNormalPart<N>, pub tangent_part: VelocityGroundConstraintTangentPart<N>, } -impl<N: SimdRealField + Copy> VelocityGroundConstraintElement<N> { +impl<N: WReal> VelocityGroundConstraintElement<N> { pub fn zero() -> Self { Self { normal_part: VelocityGroundConstraintNormalPart::zero(), @@ -156,7 +154,6 @@ impl<N: SimdRealField + Copy> VelocityGroundConstraintElement<N> { ) where Vector<N>: WBasis, AngVector<N>: WDot<AngVector<N>, Result = N>, - N::Element: SimdRealField + Copy, { // Solve penetration. if solve_normal { |
