Skip to content

Commit

Permalink
restore property name, add explicit get/set
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed Nov 19, 2019
1 parent 05ddc81 commit 2c506f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
18 changes: 14 additions & 4 deletions dart/dynamics/ShapeFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CollisionAspectProperties::CollisionAspectProperties(const bool collidable)
//==============================================================================
DynamicsAspectProperties::DynamicsAspectProperties(
const double frictionCoeff, const double restitutionCoeff)
: mPrimaryFrictionCoeff(frictionCoeff),
: mFrictionCoeff(frictionCoeff),
mRestitutionCoeff(restitutionCoeff),
mSecondaryFrictionCoeff(frictionCoeff)
{
Expand All @@ -67,7 +67,7 @@ DynamicsAspectProperties::DynamicsAspectProperties(
const double primaryFrictionCoeff,
const double secondaryFrictionCoeff,
const double restitutionCoeff)
: mPrimaryFrictionCoeff(primaryFrictionCoeff),
: mFrictionCoeff(primaryFrictionCoeff),
mRestitutionCoeff(restitutionCoeff),
mSecondaryFrictionCoeff(secondaryFrictionCoeff)
{
Expand Down Expand Up @@ -189,17 +189,27 @@ DynamicsAspect::DynamicsAspect(const PropertiesData& properties)

void DynamicsAspect::setFrictionCoeff(const double& value)
{
mProperties.mPrimaryFrictionCoeff = value;
mProperties.mFrictionCoeff = value;
mProperties.mSecondaryFrictionCoeff = value;
}

double DynamicsAspect::getFrictionCoeff() const
{
return 0.5 * (
mProperties.mPrimaryFrictionCoeff +
mProperties.mFrictionCoeff +
mProperties.mSecondaryFrictionCoeff);
}

void DynamicsAspect::setPrimaryFrictionCoeff(const double& value)
{
mProperties.mFrictionCoeff = value;
}

const double& DynamicsAspect::getPrimaryFrictionCoeff() const
{
return mProperties.mFrictionCoeff;
}

//==============================================================================
ShapeFrame::~ShapeFrame()
{
Expand Down
7 changes: 4 additions & 3 deletions dart/dynamics/ShapeFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ class DynamicsAspect final : public common::AspectWithVersionedProperties<
/// Get average of primary and secondary friction coefficients.
double getFrictionCoeff() const;

DART_COMMON_SET_GET_ASPECT_PROPERTY(double, PrimaryFrictionCoeff)
// void setPrimaryFrictionCoeff(const double& value);
// const double& getPrimaryFrictionCoeff() const;
// DART_COMMON_SET_GET_ASPECT_PROPERTY(double, PrimaryFrictionCoeff)
void setPrimaryFrictionCoeff(const double& value);
const double& getPrimaryFrictionCoeff() const;

DART_COMMON_SET_GET_ASPECT_PROPERTY(double, SecondaryFrictionCoeff)
// void setSecondaryFrictionCoeff(const double& value);
// const double& getSecondaryFrictionCoeff() const;
Expand Down
2 changes: 1 addition & 1 deletion dart/dynamics/detail/ShapeFrameAspect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct CollisionAspectProperties
struct DynamicsAspectProperties
{
/// Primary coefficient of friction
double mPrimaryFrictionCoeff;
double mFrictionCoeff;

/// Coefficient of restitution
double mRestitutionCoeff;
Expand Down

0 comments on commit 2c506f3

Please sign in to comment.