From 57aec69c1e4fef251825011d9bcf7c32ccb177f7 Mon Sep 17 00:00:00 2001 From: Sébastien Crozet Date: Sun, 8 Aug 2021 18:39:04 +0200 Subject: Update to nalgebra 0.29 --- src/dynamics/solver/delta_vel.rs | 4 ++-- src/dynamics/solver/parallel_island_solver.rs | 9 ++++++--- src/dynamics/solver/velocity_constraint.rs | 4 ++-- src/dynamics/solver/velocity_constraint_element.rs | 20 ++++++++++---------- .../solver/velocity_ground_constraint_element.rs | 18 +++++++++--------- src/utils.rs | 4 ++-- 6 files changed, 31 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/dynamics/solver/delta_vel.rs b/src/dynamics/solver/delta_vel.rs index b50cb76..b457020 100644 --- a/src/dynamics/solver/delta_vel.rs +++ b/src/dynamics/solver/delta_vel.rs @@ -9,7 +9,7 @@ pub(crate) struct DeltaVel { pub angular: AngVector, } -impl DeltaVel { +impl DeltaVel { pub fn zero() -> Self { Self { linear: na::zero(), @@ -18,7 +18,7 @@ impl DeltaVel { } } -impl AddAssign for DeltaVel { +impl AddAssign for DeltaVel { fn add_assign(&mut self, rhs: Self) { self.linear += rhs.linear; self.angular += rhs.angular; diff --git a/src/dynamics/solver/parallel_island_solver.rs b/src/dynamics/solver/parallel_island_solver.rs index d173ed4..be7ea6d 100644 --- a/src/dynamics/solver/parallel_island_solver.rs +++ b/src/dynamics/solver/parallel_island_solver.rs @@ -1,4 +1,7 @@ -use super::{DeltaVel, ParallelInteractionGroups, ParallelVelocitySolver}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +use rayon::Scope; + use crate::data::{BundleSet, ComponentSet, ComponentSetMut}; use crate::dynamics::solver::{ AnyJointPositionConstraint, AnyJointVelocityConstraint, AnyPositionConstraint, @@ -12,8 +15,8 @@ use crate::dynamics::{ use crate::geometry::{ContactManifold, ContactManifoldIndex}; use crate::math::{Isometry, Real}; use crate::utils::WAngularInertia; -use rayon::Scope; -use std::sync::atomic::{AtomicUsize, Ordering}; + +use super::{DeltaVel, ParallelInteractionGroups, ParallelVelocitySolver}; #[macro_export] #[doc(hidden)] diff --git a/src/dynamics/solver/velocity_constraint.rs b/src/dynamics/solver/velocity_constraint.rs index 90c574c..0d82f81 100644 --- a/src/dynamics/solver/velocity_constraint.rs +++ b/src/dynamics/solver/velocity_constraint.rs @@ -373,8 +373,8 @@ pub(crate) fn compute_tangent_contact_directions( linvel2: &Vector, ) -> ([Vector; DIM - 1], na::UnitComplex) where - N: na::SimdRealField, - N::Element: na::RealField, + N: na::SimdRealField + Copy, + N::Element: na::RealField + Copy, Vector: WBasis, { use na::SimdValue; diff --git a/src/dynamics/solver/velocity_constraint_element.rs b/src/dynamics/solver/velocity_constraint_element.rs index b1c244a..cb6d476 100644 --- a/src/dynamics/solver/velocity_constraint_element.rs +++ b/src/dynamics/solver/velocity_constraint_element.rs @@ -4,7 +4,7 @@ use crate::utils::{WBasis, WDot}; use na::SimdRealField; #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityConstraintTangentPart { +pub(crate) struct VelocityConstraintTangentPart { pub gcross1: [AngVector; DIM - 1], pub gcross2: [AngVector; DIM - 1], pub rhs: [N; DIM - 1], @@ -15,7 +15,7 @@ pub(crate) struct VelocityConstraintTangentPart { pub r: [N; DIM - 1], } -impl VelocityConstraintTangentPart { +impl VelocityConstraintTangentPart { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] fn zero() -> Self { Self { @@ -40,7 +40,7 @@ impl VelocityConstraintTangentPart { mj_lambda2: &mut DeltaVel, ) where AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { for j in 0..DIM - 1 { mj_lambda1.linear += tangents1[j] * (im1 * self.impulse[j]); @@ -62,7 +62,7 @@ impl VelocityConstraintTangentPart { mj_lambda2: &mut DeltaVel, ) where AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { #[cfg(feature = "dim2")] { @@ -121,7 +121,7 @@ impl VelocityConstraintTangentPart { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityConstraintNormalPart { +pub(crate) struct VelocityConstraintNormalPart { pub gcross1: AngVector, pub gcross2: AngVector, pub rhs: N, @@ -129,7 +129,7 @@ pub(crate) struct VelocityConstraintNormalPart { pub r: N, } -impl VelocityConstraintNormalPart { +impl VelocityConstraintNormalPart { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] fn zero() -> Self { Self { @@ -187,12 +187,12 @@ impl VelocityConstraintNormalPart { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityConstraintElement { +pub(crate) struct VelocityConstraintElement { pub normal_part: VelocityConstraintNormalPart, pub tangent_part: VelocityConstraintTangentPart, } -impl VelocityConstraintElement { +impl VelocityConstraintElement { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] pub fn zero() -> Self { Self { @@ -213,7 +213,7 @@ impl VelocityConstraintElement { ) where Vector: WBasis, AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { #[cfg(feature = "dim3")] let tangents1 = [tangent1, &dir1.cross(&tangent1)]; @@ -243,7 +243,7 @@ impl VelocityConstraintElement { ) where Vector: WBasis, AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { // Solve friction. #[cfg(feature = "dim3")] diff --git a/src/dynamics/solver/velocity_ground_constraint_element.rs b/src/dynamics/solver/velocity_ground_constraint_element.rs index edf84c7..2d4d633 100644 --- a/src/dynamics/solver/velocity_ground_constraint_element.rs +++ b/src/dynamics/solver/velocity_ground_constraint_element.rs @@ -4,7 +4,7 @@ use crate::utils::{WBasis, WDot}; use na::SimdRealField; #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintTangentPart { +pub(crate) struct VelocityGroundConstraintTangentPart { pub gcross2: [AngVector; DIM - 1], pub rhs: [N; DIM - 1], #[cfg(feature = "dim2")] @@ -14,7 +14,7 @@ pub(crate) struct VelocityGroundConstraintTangentPart { pub r: [N; DIM - 1], } -impl VelocityGroundConstraintTangentPart { +impl VelocityGroundConstraintTangentPart { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] fn zero() -> Self { Self { @@ -50,7 +50,7 @@ impl VelocityGroundConstraintTangentPart { mj_lambda2: &mut DeltaVel, ) where AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { #[cfg(feature = "dim2")] { @@ -96,14 +96,14 @@ impl VelocityGroundConstraintTangentPart { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintNormalPart { +pub(crate) struct VelocityGroundConstraintNormalPart { pub gcross2: AngVector, pub rhs: N, pub impulse: N, pub r: N, } -impl VelocityGroundConstraintNormalPart { +impl VelocityGroundConstraintNormalPart { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] fn zero() -> Self { Self { @@ -137,12 +137,12 @@ impl VelocityGroundConstraintNormalPart { } #[derive(Copy, Clone, Debug)] -pub(crate) struct VelocityGroundConstraintElement { +pub(crate) struct VelocityGroundConstraintElement { pub normal_part: VelocityGroundConstraintNormalPart, pub tangent_part: VelocityGroundConstraintTangentPart, } -impl VelocityGroundConstraintElement { +impl VelocityGroundConstraintElement { #[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))] pub fn zero() -> Self { Self { @@ -161,7 +161,7 @@ impl VelocityGroundConstraintElement { ) where Vector: WBasis, AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { #[cfg(feature = "dim3")] let tangents1 = [tangent1, &dir1.cross(&tangent1)]; @@ -185,7 +185,7 @@ impl VelocityGroundConstraintElement { ) where Vector: WBasis, AngVector: WDot, Result = N>, - N::Element: SimdRealField, + N::Element: SimdRealField + Copy, { // Solve friction. #[cfg(feature = "dim3")] diff --git a/src/utils.rs b/src/utils.rs index f0811d6..7f0cf46 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -112,7 +112,7 @@ pub trait WBasis: Sized { fn orthonormal_vector(self) -> Self; } -impl WBasis for Vector2 { +impl WBasis for Vector2 { type Basis = [Vector2; 1]; fn orthonormal_basis(self) -> [Vector2; 1] { [Vector2::new(-self.y, self.x)] @@ -122,7 +122,7 @@ impl WBasis for Vector2 { } } -impl> WBasis for Vector3 { +impl> WBasis for Vector3 { type Basis = [Vector3; 2]; // Robust and branchless implementation from Pixar: // https://graphics.pixar.com/library/OrthonormalB/paper.pdf -- cgit