aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-04-12 17:22:18 +0200
committerCrozet Sébastien <developer@crozet.re>2021-04-12 17:22:18 +0200
commitda9c3db5e89b90ecf0680fcd653e4ec32a4fcfe2 (patch)
tree51b8f9a77b03ff29a65c261c56ec939ff592656c
parentbe6a61815d0ad364dc328a986c5941433e4cfb41 (diff)
downloadrapier-da9c3db5e89b90ecf0680fcd653e4ec32a4fcfe2.tar.gz
rapier-da9c3db5e89b90ecf0680fcd653e4ec32a4fcfe2.tar.bz2
rapier-da9c3db5e89b90ecf0680fcd653e4ec32a4fcfe2.zip
Switch to nalgebra 0.26
-rw-r--r--.gitignore3
-rw-r--r--CHANGELOG.md4
-rw-r--r--benchmarks2d/Cargo.toml2
-rw-r--r--benchmarks3d/Cargo.toml2
-rw-r--r--build/rapier2d-f64/Cargo.toml4
-rw-r--r--build/rapier2d/Cargo.toml4
-rw-r--r--build/rapier3d-f64/Cargo.toml4
-rw-r--r--build/rapier3d/Cargo.toml4
-rw-r--r--build/rapier_testbed2d/Cargo.toml10
-rw-r--r--build/rapier_testbed3d/Cargo.toml10
-rw-r--r--examples2d/Cargo.toml2
-rw-r--r--examples3d/Cargo.toml7
-rw-r--r--examples3d/ccd3.rs9
-rw-r--r--src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs32
-rw-r--r--src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs34
-rw-r--r--src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs34
-rw-r--r--src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs34
-rw-r--r--src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs40
-rw-r--r--src/dynamics/solver/joint_constraint/revolute_velocity_constraint_wide.rs40
19 files changed, 146 insertions, 133 deletions
diff --git a/.gitignore b/.gitignore
index d8c2e33..055e3a4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ target
.idea
.DS_Store
package-lock.json
-**/*.csv \ No newline at end of file
+**/*.csv
+.vscode/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd7f370..61bce74 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v0.8.0
+### Modified
+- Switch to nalgebra 0.26.
+
## v0.7.2
### Added
- Implement `Serialize` and `Deserialize` for the `CCDSolver`.
diff --git a/benchmarks2d/Cargo.toml b/benchmarks2d/Cargo.toml
index e5c1959..fdb1690 100644
--- a/benchmarks2d/Cargo.toml
+++ b/benchmarks2d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier2d/enhanced-determinism" ]
[dependencies]
rand = "0.8"
Inflector = "0.11"
-nalgebra = "0.25"
+nalgebra = "0.26"
[dependencies.rapier_testbed2d]
path = "../build/rapier_testbed2d"
diff --git a/benchmarks3d/Cargo.toml b/benchmarks3d/Cargo.toml
index 8fafea0..a986136 100644
--- a/benchmarks3d/Cargo.toml
+++ b/benchmarks3d/Cargo.toml
@@ -14,7 +14,7 @@ enhanced-determinism = [ "rapier3d/enhanced-determinism" ]
[dependencies]
rand = "0.8"
Inflector = "0.11"
-nalgebra = "0.25"
+nalgebra = "0.26"
[dependencies.rapier_testbed3d]
path = "../build/rapier_testbed3d"
diff --git a/build/rapier2d-f64/Cargo.toml b/build/rapier2d-f64/Cargo.toml
index d9c2172..e06757b 100644
--- a/build/rapier2d-f64/Cargo.toml
+++ b/build/rapier2d-f64/Cargo.toml
@@ -43,8 +43,8 @@ required-features = [ "dim2", "f64" ]
vec_map = { version = "0.8", optional = true }
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "0.25"
-parry2d-f64 = "0.3"
+nalgebra = "0.26"
+parry2d-f64 = "0.4"
simba = "0.4"
approx = "0.4"
rayon = { version = "1", optional = true }
diff --git a/build/rapier2d/Cargo.toml b/build/rapier2d/Cargo.toml
index f243631..43cf7ad 100644
--- a/build/rapier2d/Cargo.toml
+++ b/build/rapier2d/Cargo.toml
@@ -43,8 +43,8 @@ required-features = [ "dim2", "f32" ]
vec_map = { version = "0.8", optional = true }
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "0.25"
-parry2d = "0.3"
+nalgebra = "0.26"
+parry2d = "0.4"
simba = "0.4"
approx = "0.4"
rayon = { version = "1", optional = true }
diff --git a/build/rapier3d-f64/Cargo.toml b/build/rapier3d-f64/Cargo.toml
index 7389d0d..46a7094 100644
--- a/build/rapier3d-f64/Cargo.toml
+++ b/build/rapier3d-f64/Cargo.toml
@@ -43,8 +43,8 @@ required-features = [ "dim3", "f64" ]
vec_map = { version = "0.8", optional = true }
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "^0.25.3"
-parry3d-f64 = "0.3"
+nalgebra = "0.26"
+parry3d-f64 = "0.4"
simba = "0.4"
approx = "0.4"
rayon = { version = "1", optional = true }
diff --git a/build/rapier3d/Cargo.toml b/build/rapier3d/Cargo.toml
index 41edc39..a539ab9 100644
--- a/build/rapier3d/Cargo.toml
+++ b/build/rapier3d/Cargo.toml
@@ -43,8 +43,8 @@ required-features = [ "dim3", "f32" ]
vec_map = { version = "0.8", optional = true }
instant = { version = "0.1", features = [ "now" ]}
num-traits = "0.2"
-nalgebra = "^0.25.3"
-parry3d = "0.3"
+nalgebra = "0.26"
+parry3d = "0.4"
simba = "0.4"
approx = "0.4"
rayon = { version = "1", optional = true }
diff --git a/build/rapier_testbed2d/Cargo.toml b/build/rapier_testbed2d/Cargo.toml
index a808f94..01132d2 100644
--- a/build/rapier_testbed2d/Cargo.toml
+++ b/build/rapier_testbed2d/Cargo.toml
@@ -26,17 +26,17 @@ other-backends = [ "wrapped2d", "nphysics2d" ]
[dependencies]
-nalgebra = { version = "0.25", features = [ "rand" ] }
-kiss3d = { version = "0.30", features = [ "conrod" ] }
+nalgebra = { version = "0.26", features = [ "rand" ] }
+kiss3d = { version = "0.31", features = [ "conrod" ] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = [ "web-sys", "now" ]}
bitflags = "1"
num_cpus = { version = "1", optional = true }
wrapped2d = { version = "0.4", optional = true }
-parry2d = "0.3"
-ncollide2d = "0.28"
-nphysics2d = { version = "0.20", optional = true }
+parry2d = "0.4"
+ncollide2d = "0.29"
+nphysics2d = { version = "0.21", optional = true }
crossbeam = "0.8"
bincode = "1"
Inflector = "0.11"
diff --git a/build/rapier_testbed3d/Cargo.toml b/build/rapier_testbed3d/Cargo.toml
index 4013a9c..0e3f017 100644
--- a/build/rapier_testbed3d/Cargo.toml
+++ b/build/rapier_testbed3d/Cargo.toml
@@ -25,17 +25,17 @@ parallel = [ "rapier3d/parallel", "num_cpus" ]
other-backends = [ "physx", "physx-sys", "glam", "nphysics3d" ]
[dependencies]
-nalgebra = { version = "0.25", features = [ "rand" ] }
-kiss3d = { version = "0.30", features = [ "conrod" ] }
+nalgebra = { version = "0.26", features = [ "rand" ] }
+kiss3d = { version = "0.31", features = [ "conrod" ] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = [ "web-sys", "now" ]}
bitflags = "1"
glam = { version = "0.12", optional = true }
num_cpus = { version = "1", optional = true }
-parry3d = "0.3"
-ncollide3d = "0.28"
-nphysics3d = { version = "0.20", optional = true }
+parry3d = "0.4"
+ncollide3d = "0.29"
+nphysics3d = { version = "0.21", optional = true }
physx = { version = "0.11", optional = true }
physx-sys = { version = "0.4", optional = true }
crossbeam = "0.8"
diff --git a/examples2d/Cargo.toml b/examples2d/Cargo.toml
index a226f12..b367ff8 100644
--- a/examples2d/Cargo.toml
+++ b/examples2d/Cargo.toml
@@ -15,7 +15,7 @@ enhanced-determinism = [ "rapier2d/enhanced-determinism" ]
[dependencies]
rand = "0.8"
Inflector = "0.11"
-nalgebra = "0.25"
+nalgebra = "0.26"
lyon = "0.17"
usvg = "0.13"
diff --git a/examples3d/Cargo.toml b/examples3d/Cargo.toml
index 1f84857..b7c71e0 100644
--- a/examples3d/Cargo.toml
+++ b/examples3d/Cargo.toml
@@ -13,10 +13,11 @@ other-backends = [ "rapier_testbed3d/other-backends" ]
enhanced-determinism = [ "rapier3d/enhanced-determinism" ]
[dependencies]
-rand = "0.8"
+rand = "0.8"
+getrandom = { version = "0.2", features = [ "js" ] }
Inflector = "0.11"
-nalgebra = "0.25"
-kiss3d = "0.30"
+nalgebra = "0.26"
+kiss3d = "0.31"
[dependencies.rapier_testbed3d]
path = "../build/rapier_testbed3d"
diff --git a/examples3d/ccd3.rs b/examples3d/ccd3.rs
index 19381fd..f6b558d 100644
--- a/examples3d/ccd3.rs
+++ b/examples3d/ccd3.rs
@@ -12,6 +12,7 @@ fn create_wall(
half_extents: Vector3<f32>,
) {
let shift = half_extents * 2.0;
+ let mut k = 0;
for i in 0usize..stack_height {
for j in i..stack_height {
let fj = j as f32;
@@ -27,7 +28,12 @@ fn create_wall(
let collider =
ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z).build();
colliders.insert(collider, handle, bodies);
- testbed.set_body_color(handle, Point3::new(218. / 255., 201. / 255., 1.0));
+ k += 1;
+ if k % 2 == 0 {
+ testbed.set_body_color(handle, Point3::new(255. / 255., 131. / 255., 244.0 / 255.));
+ } else {
+ testbed.set_body_color(handle, Point3::new(131. / 255., 255. / 255., 244.0 / 255.));
+ }
}
}
}
@@ -108,6 +114,7 @@ pub fn init_world(testbed: &mut Testbed) {
.build();
let handle = bodies.insert(rigid_body);
colliders.insert(collider.clone(), handle, &mut bodies);
+ testbed.set_body_color(handle, Point3::new(0.2, 0.2, 1.0));
// Callback that will be executed on the main loop to handle proximities.
testbed.add_callback(move |_, mut graphics, physics, events, _| {
diff --git a/src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs b/src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs
index 5782d86..11ade23 100644
--- a/src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs
+++ b/src/dynamics/solver/joint_constraint/fixed_velocity_constraint.rs
@@ -2,12 +2,12 @@ use crate::dynamics::solver::DeltaVel;
use crate::dynamics::{
FixedJoint, IntegrationParameters, JointGraphEdge, JointIndex, JointParams, RigidBody,
};
-use crate::math::{AngularInertia, Dim, Real, SpacialVector, Vector};
+use crate::math::{AngularInertia, Real, SpacialVector, Vector, DIM};
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
#[cfg(feature = "dim2")]
use na::{Matrix3, Vector3};
#[cfg(feature = "dim3")]
-use na::{Matrix6, Vector6, U3};
+use na::{Matrix6, Vector6};
#[derive(Debug)]
pub(crate) struct FixedVelocityConstraint {
@@ -73,10 +73,10 @@ impl FixedVelocityConstraint {
// Note that Cholesky only reads the lower-triangular part of the matrix
// so we don't need to fill lhs01.
lhs = Matrix6::zeros();
- lhs.fixed_slice_mut::<U3, U3>(0, 0)
+ lhs.fixed_slice_mut::<3, 3>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U3>(3, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(3, 3).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 3>(3, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(3, 3).copy_from(&lhs11);
}
// In 2D we just unroll the computation because
@@ -153,11 +153,11 @@ impl FixedVelocityConstraint {
let mut mj_lambda1 = mj_lambdas[self.mj_lambda1 as usize];
let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize];
- let lin_impulse = self.impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = self.impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(3).into_owned();
mj_lambda1.linear += self.im1 * lin_impulse;
mj_lambda1.angular += self
@@ -194,11 +194,11 @@ impl FixedVelocityConstraint {
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(3).into_owned();
mj_lambda1.linear += self.im1 * lin_impulse;
mj_lambda1.angular += self
@@ -286,10 +286,10 @@ impl FixedVelocityGroundConstraint {
// Note that Cholesky only reads the lower-triangular part of the matrix
// so we don't need to fill lhs01.
lhs = Matrix6::zeros();
- lhs.fixed_slice_mut::<U3, U3>(0, 0)
+ lhs.fixed_slice_mut::<3, 3>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U3>(3, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(3, 3).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 3>(3, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(3, 3).copy_from(&lhs11);
}
// In 2D we just unroll the computation because
@@ -357,11 +357,11 @@ impl FixedVelocityGroundConstraint {
pub fn warmstart(&self, mj_lambdas: &mut [DeltaVel<Real>]) {
let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize];
- let lin_impulse = self.impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = self.impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(3).into_owned();
mj_lambda2.linear -= self.im2 * lin_impulse;
mj_lambda2.angular -= self
@@ -388,11 +388,11 @@ impl FixedVelocityGroundConstraint {
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(3).into_owned();
mj_lambda2.linear -= self.im2 * lin_impulse;
mj_lambda2.angular -= self
diff --git a/src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs b/src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs
index 6b90343..b93bd3d 100644
--- a/src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs
+++ b/src/dynamics/solver/joint_constraint/fixed_velocity_constraint_wide.rs
@@ -5,12 +5,12 @@ use crate::dynamics::{
FixedJoint, IntegrationParameters, JointGraphEdge, JointIndex, JointParams, RigidBody,
};
use crate::math::{
- AngVector, AngularInertia, CrossMatrix, Dim, Isometry, Point, Real, SimdReal, SpacialVector,
- Vector, SIMD_WIDTH,
+ AngVector, AngularInertia, CrossMatrix, Isometry, Point, Real, SimdReal, SpacialVector, Vector,
+ DIM, SIMD_WIDTH,
};
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
#[cfg(feature = "dim3")]
-use na::{Cholesky, Matrix6, Vector3, Vector6, U3};
+use na::{Cholesky, Matrix6, Vector3, Vector6};
#[cfg(feature = "dim2")]
use {
na::{Matrix3, Vector3},
@@ -103,10 +103,10 @@ impl WFixedVelocityConstraint {
// Note that Cholesky only reads the lower-triangular part of the matrix
// so we don't need to fill lhs01.
lhs = Matrix6::zeros();
- lhs.fixed_slice_mut::<U3, U3>(0, 0)
+ lhs.fixed_slice_mut::<3, 3>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U3>(3, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(3, 3).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 3>(3, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(3, 3).copy_from(&lhs11);
}
// In 2D we just unroll the computation because
@@ -201,11 +201,11 @@ impl WFixedVelocityConstraint {
),
};
- let lin_impulse = self.impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = self.impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(3).into_owned();
mj_lambda1.linear += lin_impulse * self.im1;
mj_lambda1.angular += self
@@ -262,11 +262,11 @@ impl WFixedVelocityConstraint {
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(3).into_owned();
mj_lambda1.linear += lin_impulse * self.im1;
mj_lambda1.angular += self
@@ -371,10 +371,10 @@ impl WFixedVelocityGroundConstraint {
let lhs11 = ii2.into_matrix();
lhs = Matrix6::zeros();
- lhs.fixed_slice_mut::<U3, U3>(0, 0)
+ lhs.fixed_slice_mut::<3, 3>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U3>(3, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(3, 3).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 3>(3, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(3, 3).copy_from(&lhs11);
}
// In 2D we just unroll the computation because
@@ -454,11 +454,11 @@ impl WFixedVelocityGroundConstraint {
),
};
- let lin_impulse = self.impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = self.impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(3).into_owned();
mj_lambda2.linear -= lin_impulse * self.im2;
mj_lambda2.angular -= self
@@ -494,11 +494,11 @@ impl WFixedVelocityGroundConstraint {
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = impulse.fixed_rows::<Dim>(0).into_owned();
+ let lin_impulse = impulse.fixed_rows::<DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse[2];
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(3).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(3).into_owned();
mj_lambda2.linear -= lin_impulse * self.im2;
mj_lambda2.angular -= self
diff --git a/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs b/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs
index 9445896..23f746f 100644
--- a/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs
+++ b/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint.rs
@@ -5,7 +5,7 @@ use crate::dynamics::{
use crate::math::{AngularInertia, Real, Vector};
use crate::utils::{WAngularInertia, WCross, WCrossMatrix, WDot};
#[cfg(feature = "dim3")]
-use na::{Cholesky, Matrix3x2, Matrix5, Vector5, U2, U3};
+use na::{Cholesky, Matrix3x2, Matrix5, Vector5};
#[cfg(feature = "dim2")]
use {
na::{Matrix2, Vector2},
@@ -13,9 +13,9 @@ use {
};
#[cfg(feature = "dim2")]
-type LinImpulseDim = na::U1;
+const LIN_IMPULSE_DIM: usize = 1;
#[cfg(feature = "dim3")]
-type LinImpulseDim = na::U2;
+const LIN_IMPULSE_DIM: usize = 2;
#[derive(Debug)]
pub(crate) struct PrismaticVelocityConstraint {
@@ -114,10 +114,10 @@ impl PrismaticVelocityConstraint {
+ ii2.quadform3x2(&r2_mat_b1).add_diagonal(im2);
let lhs10 = ii1 * r1_mat_b1 + ii2 * r2_mat_b1;
let lhs11 = (ii1 + ii2).into_matrix();
- lhs.fixed_slice_mut::<U2, U2>(0, 0)
+ lhs.fixed_slice_mut::<2, 2>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U2>(2, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(2, 2).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 2>(2, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(2, 2).copy_from(&lhs11);
}
#[cfg(feature = "dim2")]
@@ -284,11 +284,11 @@ impl PrismaticVelocityConstraint {
let mut mj_lambda1 = mj_lambdas[self.mj_lambda1 as usize];
let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize];
- let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(2).into_owned();
mj_lambda1.linear += self.im1 * lin_impulse;
mj_lambda1.angular += self
@@ -336,11 +336,11 @@ impl PrismaticVelocityConstraint {
Vector5::new(lin_dvel.x, lin_dvel.y, ang_dvel.x, ang_dvel.y, ang_dvel.z) + self.rhs;
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = self.basis1 * impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(2).into_owned();
mj_lambda1.linear += self.im1 * lin_impulse;
mj_lambda1.angular += self
@@ -544,10 +544,10 @@ impl PrismaticVelocityGroundConstraint {
let lhs00 = ii2.quadform3x2(&r2_mat_b1).add_diagonal(im2);
let lhs10 = ii2 * r2_mat_b1;
let lhs11 = ii2.into_matrix();
- lhs.fixed_slice_mut::<U2, U2>(0, 0)
+ lhs.fixed_slice_mut::<2, 2>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U2>(2, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(2, 2).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 2>(2, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(2, 2).copy_from(&lhs11);
}
#[cfg(feature = "dim2")]
@@ -705,11 +705,11 @@ impl PrismaticVelocityGroundConstraint {
pub fn warmstart(&self, mj_lambdas: &mut [DeltaVel<Real>]) {
let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize];
- let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(2).into_owned();
mj_lambda2.linear -= self.im2 * lin_impulse;
mj_lambda2.angular -= self
@@ -737,11 +737,11 @@ impl PrismaticVelocityGroundConstraint {
Vector5::new(lin_dvel.x, lin_dvel.y, ang_dvel.x, ang_dvel.y, ang_dvel.z) + self.rhs;
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = self.basis1 * impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(2).into_owned();
mj_lambda2.linear -= self.im2 * lin_impulse;
mj_lambda2.angular -= self
diff --git a/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs b/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs
index f21acee..a60f5ca 100644
--- a/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs
+++ b/src/dynamics/solver/joint_constraint/prismatic_velocity_constraint_wide.rs
@@ -10,7 +10,7 @@ use crate::math::{
use crate::utils::{WAngularInertia, WCross, WCrossMatrix, WDot};
#[cfg(feature = "dim3")]
-use na::{Cholesky, Matrix3x2, Matrix5, Vector3, Vector5, U2, U3};
+use na::{Cholesky, Matrix3x2, Matrix5, Vector3, Vector5};
#[cfg(feature = "dim2")]
use {
@@ -19,10 +19,10 @@ use {
};
#[cfg(feature = "dim2")]
-type LinImpulseDim = na::U1;
+const LIN_IMPULSE_DIM: usize = 1;
#[cfg(feature = "dim3")]
-type LinImpulseDim = na::U2;
+const LIN_IMPULSE_DIM: usize = 2;
#[derive(Debug)]
pub(crate) struct WPrismaticVelocityConstraint {
@@ -159,10 +159,10 @@ impl WPrismaticVelocityConstraint {
+ ii2.quadform3x2(&r2_mat_b1).add_diagonal(im2);
let lhs10 = ii1 * r1_mat_b1 + ii2 * r2_mat_b1;
let lhs11 = (ii1 + ii2).into_matrix();
- lhs.fixed_slice_mut::<U2, U2>(0, 0)
+ lhs.fixed_slice_mut::<2, 2>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U2>(2, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(2, 2).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 2>(2, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(2, 2).copy_from(&lhs11);
}
#[cfg(feature = "dim2")]
@@ -319,11 +319,11 @@ impl WPrismaticVelocityConstraint {
),
};
- let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(2).into_owned();
mj_lambda1.linear += lin_impulse * self.im1;
mj_lambda1.angular += self
@@ -378,11 +378,11 @@ impl WPrismaticVelocityConstraint {
Vector5::new(lin_dvel.x, lin_dvel.y, ang_dvel.x, ang_dvel.y, ang_dvel.z) + self.rhs;
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = self.basis1 * impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(2).into_owned();
mj_lambda1.linear += lin_impulse * self.im1;
mj_lambda1.angular += self
@@ -586,10 +586,10 @@ impl WPrismaticVelocityGroundConstraint {
let lhs00 = ii2.quadform3x2(&r2_mat_b1).add_diagonal(im2);
let lhs10 = ii2 * r2_mat_b1;
let lhs11 = ii2.into_matrix();
- lhs.fixed_slice_mut::<U2, U2>(0, 0)
+ lhs.fixed_slice_mut::<2, 2>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U3, U2>(2, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U3, U3>(2, 2).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<3, 2>(2, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<3, 3>(2, 2).copy_from(&lhs11);
}
#[cfg(feature = "dim2")]
@@ -726,11 +726,11 @@ impl WPrismaticVelocityGroundConstraint {
),
};
- let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * self.impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = self.impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = self.impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = self.impulse.fixed_rows::<3>(2).into_owned();
mj_lambda2.linear -= lin_impulse * self.im2;
mj_lambda2.angular -= self
@@ -757,11 +757,11 @@ impl WPrismaticVelocityGroundConstraint {
Vector5::new(lin_dvel.x, lin_dvel.y, ang_dvel.x, ang_dvel.y, ang_dvel.z) + self.rhs;
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse = self.basis1 * impulse.fixed_rows::<LinImpulseDim>(0).into_owned();
+ let lin_impulse = self.basis1 * impulse.fixed_rows::<LIN_IMPULSE_DIM>(0).into_owned();
#[cfg(feature = "dim2")]
let ang_impulse = impulse.y;
#[cfg(feature = "dim3")]
- let ang_impulse = impulse.fixed_rows::<U3>(2).into_owned();
+ let ang_impulse = impulse.fixed_rows::<3>(2).into_owned();
mj_lambda2.linear -= lin_impulse * self.im2;
mj_lambda2.angular -= self
diff --git a/src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs b/src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs
index 23cd6b0..61a55d3 100644
--- a/src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs
+++ b/src/dynamics/solver/joint_constraint/revolute_velocity_constraint.rs
@@ -4,7 +4,7 @@ use crate::dynamics::{
};
use crate::math::{AngularInertia, Real, Rotation, Vector};
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
-use na::{Cholesky, Matrix3x2, Matrix5, UnitQuaternion, Vector5, U2, U3};
+use na::{Cholesky, Matrix3x2, Matrix5, UnitQuaternion, Vector5};
#[derive(Debug)]
pub(crate) struct RevoluteVelocityConstraint {
@@ -82,10 +82,10 @@ impl RevoluteVelocityConstraint {
// Note that Cholesky won't read the upper-right part
// of lhs so we don't have to fill it.
- lhs.fixed_slice_mut::<U3, U3>(0, 0)
+ lhs.fixed_slice_mut::<3, 3>(0, 0)
.copy_from(&lhs00.into_matrix());
- lhs.fixed_slice_mut::<U2, U3>(3, 0).copy_from(&lhs10);
- lhs.fixed_slice_mut::<U2, U2>(3, 3).copy_from(&lhs11);
+ lhs.fixed_slice_mut::<2, 3>(3, 0).copy_from(&lhs10);
+ lhs.fixed_slice_mut::<2, 2>(3, 3).copy_from(&lhs11);
let inv_lhs = Cholesky::new_unchecked(lhs).inverse();
@@ -198,10 +198,10 @@ impl RevoluteVelocityConstraint {
let mut mj_lambda1 = mj_lambdas[self.mj_lambda1 as usize];
let mut mj_lambda2 = mj_lambdas[self.mj_lambda2 as usize];
- let lin_impulse1 = self.impulse.fixed_rows::<U3>(0).into_owned();
- let lin_impulse2 = self.impulse.fixed_rows::<U3>(0).into_owned();
- let ang_impulse1 = self.basis1 * self.impulse.fixed_rows::<U2>(3).into_owned();
- let ang_impulse2 = self.basis2 * self.impulse.fixed_rows::<U2>(3).into_owned();
+ let lin_impulse1 = self.impulse.fixed_rows::<3>(0).into_owned();
+ let lin_impulse2 = self.impulse.fixed_rows::<3>(0).into_owned();
+ let ang_impulse1 = self.basis1 * self.impulse.fixed_rows::<2>(3).into_owned();
+ let ang_impulse2 = self.basis2 * self.impulse.fixed_rows::<2>(3).into_owned();
mj_lambda1.linear += self.im1 * lin_impulse1;
mj_lambda1.angular += self
@@ -240,10 +240,10 @@ impl RevoluteVelocityConstraint {
Vector5::new(lin_dvel.x, lin_dvel.y, lin_dvel.z, ang_dvel.x, ang_dvel.y) + self.rhs;
let impulse = self.inv_lhs * rhs;
self.impulse += impulse;
- let lin_impulse1 = impulse.fixed_rows::<U3>(0).into_owned();
- let lin_impulse2 = impulse.fixed_rows::<U3>(0).into_owned();
- let ang_impulse1 = self.basis1 * impulse.fixed_rows::<U2>(3).into_owned();
- let ang_impulse2 = self.basis2 * impulse.fixed_rows::<U2>(3).into_owned();
+ let lin_impulse1 = impulse.fixed_rows::<3>(0).into_owned();
+ let lin_impulse2 = impulse.fixed_ro