diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-21 21:02:23 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-01-21 21:02:27 +0100 |
| commit | 9b87f06a856c4d673642e210f8b0986cfdbac3af (patch) | |
| tree | b4f4eaac0e5004f8ba3fccd42e5aea4fd565dcc6 /src/dynamics/solver/delta_vel.rs | |
| parent | 9ac3503b879f95fcdf5414470ba5aedf195b9a97 (diff) | |
| download | rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.tar.gz rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.tar.bz2 rapier-9b87f06a856c4d673642e210f8b0986cfdbac3af.zip | |
feat: implement new "small-steps" solver + joint improvements
Diffstat (limited to 'src/dynamics/solver/delta_vel.rs')
| -rw-r--r-- | src/dynamics/solver/delta_vel.rs | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/dynamics/solver/delta_vel.rs b/src/dynamics/solver/delta_vel.rs deleted file mode 100644 index 2fc92f0..0000000 --- a/src/dynamics/solver/delta_vel.rs +++ /dev/null @@ -1,57 +0,0 @@ -use crate::math::{AngVector, Vector, SPATIAL_DIM}; -use crate::utils::WReal; -use na::{DVectorView, DVectorViewMut, Scalar}; -use std::ops::{AddAssign, Sub}; - -#[derive(Copy, Clone, Debug, Default)] -#[repr(C)] -//#[repr(align(64))] -pub struct DeltaVel<N: Scalar + Copy> { - pub linear: Vector<N>, - pub angular: AngVector<N>, -} - -impl<N: Scalar + Copy> DeltaVel<N> { - pub fn as_slice(&self) -> &[N; SPATIAL_DIM] { - unsafe { std::mem::transmute(self) } - } - - pub fn as_mut_slice(&mut self) -> &mut [N; SPATIAL_DIM] { - unsafe { std::mem::transmute(self) } - } - - pub fn as_vector_slice(&self) -> DVectorView<N> { - DVectorView::from_slice(&self.as_slice()[..], SPATIAL_DIM) - } - - pub fn as_vector_slice_mut(&mut self) -> DVectorViewMut<N> { - DVectorViewMut::from_slice(&mut self.as_mut_slice()[..], SPATIAL_DIM) - } -} - -impl<N: WReal> DeltaVel<N> { - pub fn zero() -> Self { - Self { - linear: na::zero(), - angular: na::zero(), - } - } -} - -impl<N: WReal> AddAssign for DeltaVel<N> { - fn add_assign(&mut self, rhs: Self) { - self.linear += rhs.linear; - self.angular += rhs.angular; - } -} - -impl<N: WReal> Sub for DeltaVel<N> { - type Output = Self; - - fn sub(self, rhs: Self) -> Self { - DeltaVel { - linear: self.linear - rhs.linear, - angular: self.angular - rhs.angular, - } - } -} |
