Complete the implementation of non-simd joint motor for the revolute joint.

This commit is contained in:
Crozet Sébastien
2021-02-19 15:21:25 +01:00
parent a1ddda5077
commit e9f17f32e8
14 changed files with 483 additions and 343 deletions

View File

@@ -1,8 +1,6 @@
#[cfg(feature = "dim3")]
use crate::dynamics::RevoluteJoint;
use crate::dynamics::{
BallJoint, FixedJoint, GenericJoint, JointHandle, PrismaticJoint, RigidBodyHandle,
};
use crate::dynamics::{BallJoint, FixedJoint, JointHandle, PrismaticJoint, RigidBodyHandle};
#[derive(Copy, Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
@@ -19,7 +17,7 @@ pub enum JointParams {
/// A revolute joint that removes all degrees of degrees of freedom between the affected
/// bodies except for the translation along one axis.
RevoluteJoint(RevoluteJoint),
GenericJoint(GenericJoint),
// GenericJoint(GenericJoint),
}
impl JointParams {
@@ -29,7 +27,7 @@ impl JointParams {
JointParams::BallJoint(_) => 0,
JointParams::FixedJoint(_) => 1,
JointParams::PrismaticJoint(_) => 2,
JointParams::GenericJoint(_) => 3,
// JointParams::GenericJoint(_) => 3,
#[cfg(feature = "dim3")]
JointParams::RevoluteJoint(_) => 4,
}
@@ -53,14 +51,14 @@ impl JointParams {
}
}
/// Gets a reference to the underlying generic joint, if `self` is one.
pub fn as_generic_joint(&self) -> Option<&GenericJoint> {
if let JointParams::GenericJoint(j) = self {
Some(j)
} else {
None
}
}
// /// Gets a reference to the underlying generic joint, if `self` is one.
// pub fn as_generic_joint(&self) -> Option<&GenericJoint> {
// if let JointParams::GenericJoint(j) = self {
// Some(j)
// } else {
// None
// }
// }
/// Gets a reference to the underlying prismatic joint, if `self` is one.
pub fn as_prismatic_joint(&self) -> Option<&PrismaticJoint> {
@@ -94,11 +92,11 @@ impl From<FixedJoint> for JointParams {
}
}
impl From<GenericJoint> for JointParams {
fn from(j: GenericJoint) -> Self {
JointParams::GenericJoint(j)
}
}
// impl From<GenericJoint> for JointParams {
// fn from(j: GenericJoint) -> Self {
// JointParams::GenericJoint(j)
// }
// }
#[cfg(feature = "dim3")]
impl From<RevoluteJoint> for JointParams {