Update to nalgebra 0.29
This commit is contained in:
committed by
Sébastien Crozet
parent
13aebc4242
commit
57aec69c1e
@@ -9,7 +9,7 @@ pub(crate) struct DeltaVel<N: Scalar + Copy> {
|
|||||||
pub angular: AngVector<N>,
|
pub angular: AngVector<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> DeltaVel<N> {
|
impl<N: SimdRealField + Copy> DeltaVel<N> {
|
||||||
pub fn zero() -> Self {
|
pub fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
linear: na::zero(),
|
linear: na::zero(),
|
||||||
@@ -18,7 +18,7 @@ impl<N: SimdRealField> DeltaVel<N> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> AddAssign for DeltaVel<N> {
|
impl<N: SimdRealField + Copy> AddAssign for DeltaVel<N> {
|
||||||
fn add_assign(&mut self, rhs: Self) {
|
fn add_assign(&mut self, rhs: Self) {
|
||||||
self.linear += rhs.linear;
|
self.linear += rhs.linear;
|
||||||
self.angular += rhs.angular;
|
self.angular += rhs.angular;
|
||||||
|
|||||||
@@ -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::data::{BundleSet, ComponentSet, ComponentSetMut};
|
||||||
use crate::dynamics::solver::{
|
use crate::dynamics::solver::{
|
||||||
AnyJointPositionConstraint, AnyJointVelocityConstraint, AnyPositionConstraint,
|
AnyJointPositionConstraint, AnyJointVelocityConstraint, AnyPositionConstraint,
|
||||||
@@ -12,8 +15,8 @@ use crate::dynamics::{
|
|||||||
use crate::geometry::{ContactManifold, ContactManifoldIndex};
|
use crate::geometry::{ContactManifold, ContactManifoldIndex};
|
||||||
use crate::math::{Isometry, Real};
|
use crate::math::{Isometry, Real};
|
||||||
use crate::utils::WAngularInertia;
|
use crate::utils::WAngularInertia;
|
||||||
use rayon::Scope;
|
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use super::{DeltaVel, ParallelInteractionGroups, ParallelVelocitySolver};
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|||||||
@@ -373,8 +373,8 @@ pub(crate) fn compute_tangent_contact_directions<N>(
|
|||||||
linvel2: &Vector<N>,
|
linvel2: &Vector<N>,
|
||||||
) -> ([Vector<N>; DIM - 1], na::UnitComplex<N>)
|
) -> ([Vector<N>; DIM - 1], na::UnitComplex<N>)
|
||||||
where
|
where
|
||||||
N: na::SimdRealField,
|
N: na::SimdRealField + Copy,
|
||||||
N::Element: na::RealField,
|
N::Element: na::RealField + Copy,
|
||||||
Vector<N>: WBasis,
|
Vector<N>: WBasis,
|
||||||
{
|
{
|
||||||
use na::SimdValue;
|
use na::SimdValue;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::utils::{WBasis, WDot};
|
|||||||
use na::SimdRealField;
|
use na::SimdRealField;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityConstraintTangentPart<N: SimdRealField> {
|
pub(crate) struct VelocityConstraintTangentPart<N: SimdRealField + Copy> {
|
||||||
pub gcross1: [AngVector<N>; DIM - 1],
|
pub gcross1: [AngVector<N>; DIM - 1],
|
||||||
pub gcross2: [AngVector<N>; DIM - 1],
|
pub gcross2: [AngVector<N>; DIM - 1],
|
||||||
pub rhs: [N; DIM - 1],
|
pub rhs: [N; DIM - 1],
|
||||||
@@ -15,7 +15,7 @@ pub(crate) struct VelocityConstraintTangentPart<N: SimdRealField> {
|
|||||||
pub r: [N; DIM - 1],
|
pub r: [N; DIM - 1],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityConstraintTangentPart<N> {
|
impl<N: SimdRealField + Copy> VelocityConstraintTangentPart<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
fn zero() -> Self {
|
fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -40,7 +40,7 @@ impl<N: SimdRealField> VelocityConstraintTangentPart<N> {
|
|||||||
mj_lambda2: &mut DeltaVel<N>,
|
mj_lambda2: &mut DeltaVel<N>,
|
||||||
) where
|
) where
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
for j in 0..DIM - 1 {
|
for j in 0..DIM - 1 {
|
||||||
mj_lambda1.linear += tangents1[j] * (im1 * self.impulse[j]);
|
mj_lambda1.linear += tangents1[j] * (im1 * self.impulse[j]);
|
||||||
@@ -62,7 +62,7 @@ impl<N: SimdRealField> VelocityConstraintTangentPart<N> {
|
|||||||
mj_lambda2: &mut DeltaVel<N>,
|
mj_lambda2: &mut DeltaVel<N>,
|
||||||
) where
|
) where
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
{
|
{
|
||||||
@@ -121,7 +121,7 @@ impl<N: SimdRealField> VelocityConstraintTangentPart<N> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityConstraintNormalPart<N: SimdRealField> {
|
pub(crate) struct VelocityConstraintNormalPart<N: SimdRealField + Copy> {
|
||||||
pub gcross1: AngVector<N>,
|
pub gcross1: AngVector<N>,
|
||||||
pub gcross2: AngVector<N>,
|
pub gcross2: AngVector<N>,
|
||||||
pub rhs: N,
|
pub rhs: N,
|
||||||
@@ -129,7 +129,7 @@ pub(crate) struct VelocityConstraintNormalPart<N: SimdRealField> {
|
|||||||
pub r: N,
|
pub r: N,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityConstraintNormalPart<N> {
|
impl<N: SimdRealField + Copy> VelocityConstraintNormalPart<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
fn zero() -> Self {
|
fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -187,12 +187,12 @@ impl<N: SimdRealField> VelocityConstraintNormalPart<N> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityConstraintElement<N: SimdRealField> {
|
pub(crate) struct VelocityConstraintElement<N: SimdRealField + Copy> {
|
||||||
pub normal_part: VelocityConstraintNormalPart<N>,
|
pub normal_part: VelocityConstraintNormalPart<N>,
|
||||||
pub tangent_part: VelocityConstraintTangentPart<N>,
|
pub tangent_part: VelocityConstraintTangentPart<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityConstraintElement<N> {
|
impl<N: SimdRealField + Copy> VelocityConstraintElement<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
pub fn zero() -> Self {
|
pub fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -213,7 +213,7 @@ impl<N: SimdRealField> VelocityConstraintElement<N> {
|
|||||||
) where
|
) where
|
||||||
Vector<N>: WBasis,
|
Vector<N>: WBasis,
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let tangents1 = [tangent1, &dir1.cross(&tangent1)];
|
let tangents1 = [tangent1, &dir1.cross(&tangent1)];
|
||||||
@@ -243,7 +243,7 @@ impl<N: SimdRealField> VelocityConstraintElement<N> {
|
|||||||
) where
|
) where
|
||||||
Vector<N>: WBasis,
|
Vector<N>: WBasis,
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
// Solve friction.
|
// Solve friction.
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use crate::utils::{WBasis, WDot};
|
|||||||
use na::SimdRealField;
|
use na::SimdRealField;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityGroundConstraintTangentPart<N: SimdRealField> {
|
pub(crate) struct VelocityGroundConstraintTangentPart<N: SimdRealField + Copy> {
|
||||||
pub gcross2: [AngVector<N>; DIM - 1],
|
pub gcross2: [AngVector<N>; DIM - 1],
|
||||||
pub rhs: [N; DIM - 1],
|
pub rhs: [N; DIM - 1],
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
@@ -14,7 +14,7 @@ pub(crate) struct VelocityGroundConstraintTangentPart<N: SimdRealField> {
|
|||||||
pub r: [N; DIM - 1],
|
pub r: [N; DIM - 1],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityGroundConstraintTangentPart<N> {
|
impl<N: SimdRealField + Copy> VelocityGroundConstraintTangentPart<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
fn zero() -> Self {
|
fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -50,7 +50,7 @@ impl<N: SimdRealField> VelocityGroundConstraintTangentPart<N> {
|
|||||||
mj_lambda2: &mut DeltaVel<N>,
|
mj_lambda2: &mut DeltaVel<N>,
|
||||||
) where
|
) where
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
{
|
{
|
||||||
@@ -96,14 +96,14 @@ impl<N: SimdRealField> VelocityGroundConstraintTangentPart<N> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityGroundConstraintNormalPart<N: SimdRealField> {
|
pub(crate) struct VelocityGroundConstraintNormalPart<N: SimdRealField + Copy> {
|
||||||
pub gcross2: AngVector<N>,
|
pub gcross2: AngVector<N>,
|
||||||
pub rhs: N,
|
pub rhs: N,
|
||||||
pub impulse: N,
|
pub impulse: N,
|
||||||
pub r: N,
|
pub r: N,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityGroundConstraintNormalPart<N> {
|
impl<N: SimdRealField + Copy> VelocityGroundConstraintNormalPart<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
fn zero() -> Self {
|
fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -137,12 +137,12 @@ impl<N: SimdRealField> VelocityGroundConstraintNormalPart<N> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
pub(crate) struct VelocityGroundConstraintElement<N: SimdRealField> {
|
pub(crate) struct VelocityGroundConstraintElement<N: SimdRealField + Copy> {
|
||||||
pub normal_part: VelocityGroundConstraintNormalPart<N>,
|
pub normal_part: VelocityGroundConstraintNormalPart<N>,
|
||||||
pub tangent_part: VelocityGroundConstraintTangentPart<N>,
|
pub tangent_part: VelocityGroundConstraintTangentPart<N>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> VelocityGroundConstraintElement<N> {
|
impl<N: SimdRealField + Copy> VelocityGroundConstraintElement<N> {
|
||||||
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
#[cfg(any(not(target_arch = "wasm32"), feature = "simd-is-enabled"))]
|
||||||
pub fn zero() -> Self {
|
pub fn zero() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -161,7 +161,7 @@ impl<N: SimdRealField> VelocityGroundConstraintElement<N> {
|
|||||||
) where
|
) where
|
||||||
Vector<N>: WBasis,
|
Vector<N>: WBasis,
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
let tangents1 = [tangent1, &dir1.cross(&tangent1)];
|
let tangents1 = [tangent1, &dir1.cross(&tangent1)];
|
||||||
@@ -185,7 +185,7 @@ impl<N: SimdRealField> VelocityGroundConstraintElement<N> {
|
|||||||
) where
|
) where
|
||||||
Vector<N>: WBasis,
|
Vector<N>: WBasis,
|
||||||
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
AngVector<N>: WDot<AngVector<N>, Result = N>,
|
||||||
N::Element: SimdRealField,
|
N::Element: SimdRealField + Copy,
|
||||||
{
|
{
|
||||||
// Solve friction.
|
// Solve friction.
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ pub trait WBasis: Sized {
|
|||||||
fn orthonormal_vector(self) -> Self;
|
fn orthonormal_vector(self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField> WBasis for Vector2<N> {
|
impl<N: SimdRealField + Copy> WBasis for Vector2<N> {
|
||||||
type Basis = [Vector2<N>; 1];
|
type Basis = [Vector2<N>; 1];
|
||||||
fn orthonormal_basis(self) -> [Vector2<N>; 1] {
|
fn orthonormal_basis(self) -> [Vector2<N>; 1] {
|
||||||
[Vector2::new(-self.y, self.x)]
|
[Vector2::new(-self.y, self.x)]
|
||||||
@@ -122,7 +122,7 @@ impl<N: SimdRealField> WBasis for Vector2<N> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: SimdRealField + WSign<N>> WBasis for Vector3<N> {
|
impl<N: SimdRealField + Copy + WSign<N>> WBasis for Vector3<N> {
|
||||||
type Basis = [Vector3<N>; 2];
|
type Basis = [Vector3<N>; 2];
|
||||||
// Robust and branchless implementation from Pixar:
|
// Robust and branchless implementation from Pixar:
|
||||||
// https://graphics.pixar.com/library/OrthonormalB/paper.pdf
|
// https://graphics.pixar.com/library/OrthonormalB/paper.pdf
|
||||||
|
|||||||
Reference in New Issue
Block a user