aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Crozet <sebcrozet@dimforge.com>2024-05-26 18:12:26 +0200
committerSébastien Crozet <sebastien@crozet.re>2024-06-09 12:09:58 +0200
commitc785ea49965aa151e942feb3da0fb4ba03768441 (patch)
tree2bbe82ce435bb9e6a87175ed78fefcb82e722967 /src
parent5c44d936f7449e7925b124681cfbfd64cb031123 (diff)
downloadrapier-c785ea49965aa151e942feb3da0fb4ba03768441.tar.gz
rapier-c785ea49965aa151e942feb3da0fb4ba03768441.tar.bz2
rapier-c785ea49965aa151e942feb3da0fb4ba03768441.zip
feat: rename JointAxesMask::X/Y/Z by ::LIN_X/LIN_Y/LIN_Z and JointAxis::X/Y/Z by ::LinX/LinY/LinZ
Diffstat (limited to 'src')
-rw-r--r--src/dynamics/joint/generic_joint.rs54
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_ik.rs6
-rw-r--r--src/dynamics/joint/prismatic_joint.rs16
-rw-r--r--src/dynamics/joint/rope_joint.rs14
-rw-r--r--src/dynamics/joint/spring_joint.rs6
5 files changed, 48 insertions, 48 deletions
diff --git a/src/dynamics/joint/generic_joint.rs b/src/dynamics/joint/generic_joint.rs
index 8c8a4aa..2651592 100644
--- a/src/dynamics/joint/generic_joint.rs
+++ b/src/dynamics/joint/generic_joint.rs
@@ -13,12 +13,12 @@ bitflags::bitflags! {
/// A bit mask identifying multiple degrees of freedom of a joint.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct JointAxesMask: u8 {
- /// The translational degree of freedom along the local X axis of a joint.
- const X = 1 << 0;
- /// The translational degree of freedom along the local Y axis of a joint.
- const Y = 1 << 1;
- /// The translational degree of freedom along the local Z axis of a joint.
- const Z = 1 << 2;
+ /// The linear (translational) degree of freedom along the local X axis of a joint.
+ const LIN_X = 1 << 0;
+ /// The linear (translational) degree of freedom along the local Y axis of a joint.
+ const LIN_Y = 1 << 1;
+ /// The linear (translational) degree of freedom along the local Z axis of a joint.
+ const LIN_Z = 1 << 2;
/// The angular degree of freedom along the local X axis of a joint.
const ANG_X = 1 << 3;
/// The angular degree of freedom along the local Y axis of a joint.
@@ -26,23 +26,23 @@ bitflags::bitflags! {
/// The angular degree of freedom along the local Z axis of a joint.
const ANG_Z = 1 << 5;
/// The set of degrees of freedom locked by a revolute joint.
- const LOCKED_REVOLUTE_AXES = Self::X.bits | Self::Y.bits | Self::Z.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
/// The set of degrees of freedom locked by a prismatic joint.
- const LOCKED_PRISMATIC_AXES = Self::Y.bits | Self::Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
/// The set of degrees of freedom locked by a fixed joint.
- const LOCKED_FIXED_AXES = Self::X.bits | Self::Y.bits | Self::Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
+ const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
/// The set of degrees of freedom locked by a spherical joint.
- const LOCKED_SPHERICAL_AXES = Self::X.bits | Self::Y.bits | Self::Z.bits;
+ const LOCKED_SPHERICAL_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits;
/// The set of degrees of freedom left free by a revolute joint.
const FREE_REVOLUTE_AXES = Self::ANG_X.bits;
/// The set of degrees of freedom left free by a prismatic joint.
- const FREE_PRISMATIC_AXES = Self::X.bits;
+ const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
/// The set of degrees of freedom left free by a fixed joint.
const FREE_FIXED_AXES = 0;
/// The set of degrees of freedom left free by a spherical joint.
const FREE_SPHERICAL_AXES = Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits;
/// The set of all translational degrees of freedom.
- const LIN_AXES = Self::X.bits() | Self::Y.bits() | Self::Z.bits();
+ const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits();
/// The set of all angular degrees of freedom.
const ANG_AXES = Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits();
}
@@ -53,26 +53,26 @@ bitflags::bitflags! {
/// A bit mask identifying multiple degrees of freedom of a joint.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct JointAxesMask: u8 {
- /// The translational degree of freedom along the local X axis of a joint.
- const X = 1 << 0;
- /// The translational degree of freedom along the local Y axis of a joint.
- const Y = 1 << 1;
+ /// The linear (translational) degree of freedom along the local X axis of a joint.
+ const LIN_X = 1 << 0;
+ /// The linear (translational) degree of freedom along the local Y axis of a joint.
+ const LIN_Y = 1 << 1;
/// The angular degree of freedom of a joint.
const ANG_X = 1 << 2;
/// The set of degrees of freedom locked by a revolute joint.
- const LOCKED_REVOLUTE_AXES = Self::X.bits | Self::Y.bits;
+ const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits;
/// The set of degrees of freedom locked by a prismatic joint.
- const LOCKED_PRISMATIC_AXES = Self::Y.bits | Self::ANG_X.bits;
+ const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::ANG_X.bits;
/// The set of degrees of freedom locked by a fixed joint.
- const LOCKED_FIXED_AXES = Self::X.bits | Self::Y.bits | Self::ANG_X.bits;
+ const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::ANG_X.bits;
/// The set of degrees of freedom left free by a revolute joint.
const FREE_REVOLUTE_AXES = Self::ANG_X.bits;
/// The set of degrees of freedom left free by a prismatic joint.
- const FREE_PRISMATIC_AXES = Self::X.bits;
+ const FREE_PRISMATIC_AXES = Self::LIN_X.bits;
/// The set of degrees of freedom left free by a fixed joint.
const FREE_FIXED_AXES = 0;
/// The set of all translational degrees of freedom.
- const LIN_AXES = Self::X.bits() | Self::Y.bits();
+ const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits();
/// The set of all angular degrees of freedom.
const ANG_AXES = Self::ANG_X.bits();
}
@@ -88,13 +88,13 @@ impl Default for JointAxesMask {
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum JointAxis {
- /// The translational degree of freedom along the joint’s local X axis.
- X = 0,
- /// The translational degree of freedom along the joint’s local Y axis.
- Y,
- /// The translational degree of freedom along the joint’s local Z axis.
+ /// The linear (translational) degree of freedom along the joint’s local X axis.
+ LinX = 0,
+ /// The linear (translational) degree of freedom along the joint’s local Y axis.
+ LinY,
+ /// The linear (translational) degree of freedom along the joint’s local Z axis.
#[cfg(feature = "dim3")]
- Z,
+ LinZ,
/// The rotational degree of freedom along the joint’s local X axis.
AngX,
/// The rotational degree of freedom along the joint’s local Y axis.
diff --git a/src/dynamics/joint/multibody_joint/multibody_ik.rs b/src/dynamics/joint/multibody_joint/multibody_ik.rs
index 7e0fc15..2171cf6 100644
--- a/src/dynamics/joint/multibody_joint/multibody_ik.rs
+++ b/src/dynamics/joint/multibody_joint/multibody_ik.rs
@@ -116,14 +116,14 @@ impl Multibody {
delta_ang.z
];
- if !options.constrained_axes.contains(JointAxesMask::X) {
+ if !options.constrained_axes.contains(JointAxesMask::LIN_X) {
delta[0] = 0.0;
}
- if !options.constrained_axes.contains(JointAxesMask::Y) {
+ if !options.constrained_axes.contains(JointAxesMask::LIN_Y) {
delta[1] = 0.0;
}
#[cfg(feature = "dim3")]
- if !options.constrained_axes.contains(JointAxesMask::Z) {
+ if !options.constrained_axes.contains(JointAxesMask::LIN_Z) {
delta[2] = 0.0;
}
if !options.constrained_axes.contains(JointAxesMask::ANG_X) {
diff --git a/src/dynamics/joint/prismatic_joint.rs b/src/dynamics/joint/prismatic_joint.rs
index d0f3a7d..8a1c59f 100644
--- a/src/dynamics/joint/prismatic_joint.rs
+++ b/src/dynamics/joint/prismatic_joint.rs
@@ -92,19 +92,19 @@ impl PrismaticJoint {
/// The motor affecting the joint’s translational degree of freedom.
#[must_use]
pub fn motor(&self) -> Option<&JointMotor> {
- self.data.motor(JointAxis::X)
+ self.data.motor(JointAxis::LinX)
}
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
- self.data.set_motor_model(JointAxis::X, model);
+ self.data.set_motor_model(JointAxis::LinX, model);
self
}
/// Sets the target velocity this motor needs to reach.
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
self.data
- .set_motor_velocity(JointAxis::X, target_vel, factor);
+ .set_motor_velocity(JointAxis::LinX, target_vel, factor);
self
}
@@ -116,7 +116,7 @@ impl PrismaticJoint {
damping: Real,
) -> &mut Self {
self.data
- .set_motor_position(JointAxis::X, target_pos, stiffness, damping);
+ .set_motor_position(JointAxis::LinX, target_pos, stiffness, damping);
self
}
@@ -129,25 +129,25 @@ impl PrismaticJoint {
damping: Real,
) -> &mut Self {
self.data
- .set_motor(JointAxis::X, target_pos, target_vel, stiffness, damping);
+ .set_motor(JointAxis::LinX, target_pos, target_vel, stiffness, damping);
self
}
/// Sets the maximum force the motor can deliver.
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
- self.data.set_motor_max_force(JointAxis::X, max_force);
+ self.data.set_motor_max_force(JointAxis::LinX, max_force);
self
}
/// The limit distance attached bodies can translate along the joint’s principal axis.
#[must_use]
pub fn limits(&self) -> Option<&JointLimits<Real>> {
- self.data.limits(JointAxis::X)
+ self.data.limits(JointAxis::LinX)
}
/// Sets the `[min,max]` limit distances attached bodies can translate along the joint’s principal axis.
pub fn set_limits(&mut self, limits: [Real; 2]) -> &mut Self {
- self.data.set_limits(JointAxis::X, limits);
+ self.data.set_limits(JointAxis::LinX, limits);
self
}
}
diff --git a/src/dynamics/joint/rope_joint.rs b/src/dynamics/joint/rope_joint.rs
index 64a66ea..67c0c3e 100644
--- a/src/dynamics/joint/rope_joint.rs
+++ b/src/dynamics/joint/rope_joint.rs
@@ -74,14 +74,14 @@ impl RopeJoint {
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
pub fn set_motor_model(&mut self, model: MotorModel) -> &mut Self {
- self.data.set_motor_model(JointAxis::X, model);
+ self.data.set_motor_model(JointAxis::LinX, model);
self
}
/// Sets the target velocity this motor needs to reach.
pub fn set_motor_velocity(&mut self, target_vel: Real, factor: Real) -> &mut Self {
self.data
- .set_motor_velocity(JointAxis::X, target_vel, factor);
+ .set_motor_velocity(JointAxis::LinX, target_vel, factor);
self
}
@@ -93,7 +93,7 @@ impl RopeJoint {
damping: Real,
) -> &mut Self {
self.data
- .set_motor_position(JointAxis::X, target_pos, stiffness, damping);
+ .set_motor_position(JointAxis::LinX, target_pos, stiffness, damping);
self
}
@@ -106,13 +106,13 @@ impl RopeJoint {
damping: Real,
) -> &mut Self {
self.data
- .set_motor(JointAxis::X, target_pos, target_vel, stiffness, damping);
+ .set_motor(JointAxis::LinX, target_pos, target_vel, stiffness, damping);
self
}
/// Sets the maximum force the motor can deliver.
pub fn set_motor_max_force(&mut self, max_force: Real) -> &mut Self {
- self.data.set_motor_max_force(JointAxis::X, max_force);
+ self.data.set_motor_max_force(JointAxis::LinX, max_force);
self
}
@@ -120,7 +120,7 @@ impl RopeJoint {
#[must_use]
pub fn max_distance(&self) -> Real {
self.data
- .limits(JointAxis::X)
+ .limits(JointAxis::LinX)
.map(|l| l.max)
.unwrap_or(Real::MAX)
}
@@ -129,7 +129,7 @@ impl RopeJoint {
///
/// The `max_dist` must be strictly greater than 0.0.
pub fn set_max_distance(&mut self, max_dist: Real) -> &mut Self {
- self.data.set_limits(JointAxis::X, [0.0, max_dist]);
+ self.data.set_limits(JointAxis::LinX, [0.0, max_dist]);
self
}
}
diff --git a/src/dynamics/joint/spring_joint.rs b/src/dynamics/joint/spring_joint.rs
index f5cb5bd..eea639f 100644
--- a/src/dynamics/joint/spring_joint.rs
+++ b/src/dynamics/joint/spring_joint.rs
@@ -22,8 +22,8 @@ impl SpringJoint {
pub fn new(rest_length: Real, stiffness: Real, damping: Real) -> Self {
let data = GenericJointBuilder::new(JointAxesMask::empty())
.coupled_axes(JointAxesMask::LIN_AXES)
- .motor_position(JointAxis::X, rest_length, stiffness, damping)
- .motor_model(JointAxis::X, MotorModel::ForceBased)
+ .motor_position(JointAxis::LinX, rest_length, stiffness, damping)
+ .motor_model(JointAxis::LinX, MotorModel::ForceBased)
.build();
Self { data }
}
@@ -75,7 +75,7 @@ impl SpringJoint {
/// `MotorModel::AccelerationBased`, the spring constants will be automatically scaled by the attached masses,
/// making the spring more mass-independent.
pub fn set_spring_model(&mut self, model: MotorModel) -> &mut Self {
- self.data.set_motor_model(JointAxis::X, model);
+ self.data.set_motor_model(JointAxis::LinX, model);
self
}