diff options
| author | Sébastien Crozet <sebcrozet@dimforge.com> | 2024-06-09 10:57:37 +0200 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2024-06-09 12:09:58 +0200 |
| commit | edaa36ac7e702f419faab4ff1b9af858fc84177f (patch) | |
| tree | 059a92ef66db3f4769146ef20b64b3dcbb649129 /src | |
| parent | cfddaa3c46e58f59d551e3dc7fc5d4380b322789 (diff) | |
| download | rapier-edaa36ac7e702f419faab4ff1b9af858fc84177f.tar.gz rapier-edaa36ac7e702f419faab4ff1b9af858fc84177f.tar.bz2 rapier-edaa36ac7e702f419faab4ff1b9af858fc84177f.zip | |
chore: add more comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/ccd/toi_entry.rs | 4 | ||||
| -rw-r--r-- | src/dynamics/joint/multibody_joint/multibody.rs | 4 | ||||
| -rw-r--r-- | src/dynamics/joint/multibody_joint/multibody_joint.rs | 4 | ||||
| -rw-r--r-- | src/dynamics/joint/multibody_joint/multibody_joint_set.rs | 1 | ||||
| -rw-r--r-- | src/dynamics/solver/contact_constraint/contact_constraints_set.rs | 1 | ||||
| -rw-r--r-- | src/dynamics/solver/joint_constraint/joint_constraint_builder.rs | 10 | ||||
| -rw-r--r-- | src/geometry/mesh_converter.rs | 8 | ||||
| -rw-r--r-- | src/lib.rs | 2 |
8 files changed, 21 insertions, 13 deletions
diff --git a/src/dynamics/ccd/toi_entry.rs b/src/dynamics/ccd/toi_entry.rs index 426cbb1..82b4532 100644 --- a/src/dynamics/ccd/toi_entry.rs +++ b/src/dynamics/ccd/toi_entry.rs @@ -13,7 +13,6 @@ pub struct TOIEntry { // We call this "pseudo" intersection because this also // includes colliders pairs with mismatching solver_groups. pub is_pseudo_intersection_test: bool, - pub timestamp: usize, } impl TOIEntry { @@ -24,7 +23,6 @@ impl TOIEntry { c2: ColliderHandle, b2: Option<RigidBodyHandle>, is_pseudo_intersection_test: bool, - timestamp: usize, ) -> Self { Self { toi, @@ -33,7 +31,6 @@ impl TOIEntry { c2, b2, is_pseudo_intersection_test, - timestamp, } } @@ -149,7 +146,6 @@ impl TOIEntry { ch2, co2.parent.map(|p| p.handle), is_pseudo_intersection_test, - 0, )) } diff --git a/src/dynamics/joint/multibody_joint/multibody.rs b/src/dynamics/joint/multibody_joint/multibody.rs index 352f289..acf1444 100644 --- a/src/dynamics/joint/multibody_joint/multibody.rs +++ b/src/dynamics/joint/multibody_joint/multibody.rs @@ -569,8 +569,6 @@ impl Multibody { return; // Nothing to do. } - let mut kinematic_ndofs = 0; - if self.augmented_mass.ncols() != self.ndofs { // TODO: do a resize instead of a full reallocation. self.augmented_mass = DMatrix::zeros(self.ndofs, self.ndofs); @@ -1058,7 +1056,7 @@ impl Multibody { bodies: &RigidBodySet, link_id: usize, displacement: Option<&[Real]>, - mut out_jacobian: Option<&mut Jacobian<Real>>, + out_jacobian: Option<&mut Jacobian<Real>>, ) -> Isometry<Real> { let branch = self.kinematic_branch(link_id); self.forward_kinematics_single_branch(bodies, &branch, displacement, out_jacobian) diff --git a/src/dynamics/joint/multibody_joint/multibody_joint.rs b/src/dynamics/joint/multibody_joint/multibody_joint.rs index 6b37cb9..179b061 100644 --- a/src/dynamics/joint/multibody_joint/multibody_joint.rs +++ b/src/dynamics/joint/multibody_joint/multibody_joint.rs @@ -17,6 +17,10 @@ use na::{UnitQuaternion, Vector3}; pub struct MultibodyJoint { /// The joint’s description. pub data: GenericJoint, + /// Is the joint a kinematic joint? + /// + /// Kinematic joint velocities are never changed by the physics engine. This gives the user + /// total control over the values of their degrees of freedoms. pub kinematic: bool, pub(crate) coords: SpacialVector<Real>, pub(crate) joint_rot: Rotation<Real>, diff --git a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs index 092a250..6ffdece 100644 --- a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs +++ b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs @@ -158,7 +158,6 @@ impl MultibodyJointSet { kinematic: bool, wake_up: bool, ) -> Option<MultibodyJointHandle> { - println!("Inserting kinematic: {}", kinematic); let link1 = self.rb2mb.get(body1.0).copied().unwrap_or_else(|| { let mb_handle = self.multibodies.insert(Multibody::with_root(body1, true)); MultibodyLinkId { diff --git a/src/dynamics/solver/contact_constraint/contact_constraints_set.rs b/src/dynamics/solver/contact_constraint/contact_constraints_set.rs index 6809c37..4d2b40d 100644 --- a/src/dynamics/solver/contact_constraint/contact_constraints_set.rs +++ b/src/dynamics/solver/contact_constraint/contact_constraints_set.rs @@ -28,6 +28,7 @@ use { #[derive(Debug)] pub struct ConstraintsCounts { pub num_constraints: usize, + #[allow(dead_code)] // Keep this around for now. Might be useful once we rework parallelism. pub num_jacobian_lines: usize, } diff --git a/src/dynamics/solver/joint_constraint/joint_constraint_builder.rs b/src/dynamics/solver/joint_constraint/joint_constraint_builder.rs index 40613c1..c6d5fa0 100644 --- a/src/dynamics/solver/joint_constraint/joint_constraint_builder.rs +++ b/src/dynamics/solver/joint_constraint/joint_constraint_builder.rs @@ -9,11 +9,11 @@ use crate::dynamics::{GenericJoint, ImpulseJoint, IntegrationParameters, JointIn use crate::math::{AngVector, Isometry, Matrix, Point, Real, Rotation, Vector, ANG_DIM, DIM}; use crate::prelude::RigidBodySet; use crate::utils; -use crate::utils::{IndexMut2, SimdCrossMatrix, SimdDot, SimdQuat, SimdRealCopy}; +use crate::utils::{IndexMut2, SimdCrossMatrix, SimdDot, SimdRealCopy}; use na::SMatrix; #[cfg(feature = "dim3")] -use crate::utils::SimdBasis; +use crate::utils::{SimdBasis, SimdQuat}; #[cfg(feature = "simd-is-enabled")] use crate::math::{SimdReal, SIMD_WIDTH}; @@ -345,9 +345,11 @@ impl JointOneBodyConstraintBuilderSimd { #[derive(Debug, Copy, Clone)] pub struct JointTwoBodyConstraintHelper<N: SimdRealCopy> { pub basis: Matrix<N>, + #[cfg(feature = "dim3")] pub basis2: Matrix<N>, // TODO: used for angular coupling. Can we avoid storing this? pub cmat1_basis: SMatrix<N, ANG_DIM, DIM>, pub cmat2_basis: SMatrix<N, ANG_DIM, DIM>, + #[cfg(feature = "dim3")] pub ang_basis: SMatrix<N, ANG_DIM, ANG_DIM>, pub lin_err: Vector<N>, pub ang_err: Rotation<N>, @@ -387,7 +389,7 @@ impl<N: SimdRealCopy> JointTwoBodyConstraintHelper<N> { let cmat1 = r1.gcross_matrix(); let cmat2 = r2.gcross_matrix(); - #[allow(unused_mut)] // The mut is needed for 3D + #[cfg(feature = "dim3")] let mut ang_basis = frame1.rotation.diff_conj1_2(&frame2.rotation).transpose(); #[allow(unused_mut)] // The mut is needed for 3D let mut ang_err = frame1.rotation.inverse() * frame2.rotation; @@ -401,9 +403,11 @@ impl<N: SimdRealCopy> JointTwoBodyConstraintHelper<N> { Self { basis, + #[cfg(feature = "dim3")] basis2: frame2.rotation.to_rotation_matrix().into_inner(), cmat1_basis: cmat1 * basis, cmat2_basis: cmat2 * basis, + #[cfg(feature = "dim3")] ang_basis, lin_err, ang_err, diff --git a/src/geometry/mesh_converter.rs b/src/geometry/mesh_converter.rs index 44d5829..5d47f79 100644 --- a/src/geometry/mesh_converter.rs +++ b/src/geometry/mesh_converter.rs @@ -1,6 +1,8 @@ use parry::bounding_volume; -use parry::math::{Isometry, Point, Real, DIM}; +use parry::math::{Isometry, Point, Real}; use parry::shape::{Cuboid, SharedShape, TriMeshFlags}; + +#[cfg(feature = "dim3")] use parry::transformation::vhacd::VHACDParameters; /* @@ -9,8 +11,10 @@ use parry::transformation::vhacd::VHACDParameters; * */ +/// Error that can be generated by the [`MeshConverter`]. #[derive(thiserror::Error, Debug)] pub enum MeshConverterError { + /// The convex hull calculation carried out by the [`MeshConverter::ConvexHull`] failed. #[error("convex-hull computation failed")] ConvexHullFailed, } @@ -47,6 +51,8 @@ pub enum MeshConverter { } impl MeshConverter { + /// Applies the conversion rule described by this [`MeshConverter`] to build a shape from + /// the given vertex and index buffers. pub fn convert( &self, vertices: Vec<Point<Real>>, @@ -11,7 +11,7 @@ //! User documentation for Rapier is on [the official Rapier site](https://rapier.rs/docs/). #![deny(bare_trait_objects)] -#![warn(missing_docs)] // FIXME: deny that +#![warn(missing_docs)] #![allow(clippy::too_many_arguments)] #![allow(clippy::needless_range_loop)] // TODO: remove this? I find that in the math code using indices adds clarity. #![allow(clippy::module_inception)] |
