From 6e2f7f3f87902dbd83bc0f66846247df276d0e29 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 22 Jul 2023 00:50:02 -0700 Subject: [PATCH] EllipsoidShape: use const references in API Pass the Vector of Ellipsoid radii as a const reference to SetRadii and AttachEllipsoidShape. Signed-off-by: Steve Peters --- bullet-featherstone/src/ShapeFeatures.cc | 2 +- bullet-featherstone/src/ShapeFeatures.hh | 2 +- dartsim/src/ShapeFeatures.cc | 2 +- dartsim/src/ShapeFeatures.hh | 2 +- include/gz/physics/EllipsoidShape.hh | 8 ++++---- include/gz/physics/detail/EllipsoidShape.hh | 4 ++-- tpe/plugin/src/ShapeFeatures.cc | 2 +- tpe/plugin/src/ShapeFeatures.hh | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bullet-featherstone/src/ShapeFeatures.cc b/bullet-featherstone/src/ShapeFeatures.cc index 34096292f..d9366cd86 100644 --- a/bullet-featherstone/src/ShapeFeatures.cc +++ b/bullet-featherstone/src/ShapeFeatures.cc @@ -303,7 +303,7 @@ Vector3d ShapeFeatures::GetEllipsoidShapeRadii( Identity ShapeFeatures::AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - const Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) { btVector3 positions[1]; diff --git a/bullet-featherstone/src/ShapeFeatures.hh b/bullet-featherstone/src/ShapeFeatures.hh index 143f892fb..998c97e66 100644 --- a/bullet-featherstone/src/ShapeFeatures.hh +++ b/bullet-featherstone/src/ShapeFeatures.hh @@ -117,7 +117,7 @@ class ShapeFeatures : public: Identity AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - const Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) override; // ----- Sphere Features ----- diff --git a/dartsim/src/ShapeFeatures.cc b/dartsim/src/ShapeFeatures.cc index dfbf01277..8b42a0dbb 100644 --- a/dartsim/src/ShapeFeatures.cc +++ b/dartsim/src/ShapeFeatures.cc @@ -252,7 +252,7 @@ Vector3d ShapeFeatures::GetEllipsoidShapeRadii( Identity ShapeFeatures::AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - const Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) { common::MeshManager *meshMgr = common::MeshManager::Instance(); diff --git a/dartsim/src/ShapeFeatures.hh b/dartsim/src/ShapeFeatures.hh index 0c4d5370e..e83992419 100644 --- a/dartsim/src/ShapeFeatures.hh +++ b/dartsim/src/ShapeFeatures.hh @@ -148,7 +148,7 @@ class ShapeFeatures : public: Identity AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - const Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) override; // ----- Sphere Features ----- diff --git a/include/gz/physics/EllipsoidShape.hh b/include/gz/physics/EllipsoidShape.hh index fcb2d0f77..c4f4a63e1 100644 --- a/include/gz/physics/EllipsoidShape.hh +++ b/include/gz/physics/EllipsoidShape.hh @@ -69,7 +69,7 @@ namespace gz /// \brief Set the radius of this EllipsoidShape /// \param[in] _radii /// The desired radius of this EllipsoidShape - public: void SetRadii(Dimensions _radii); + public: void SetRadii(const Dimensions &_radii); }; public: template @@ -79,7 +79,7 @@ namespace gz typename FromPolicy::template Use; public: virtual void SetEllipsoidShapeRadii( - const Identity &_ellipsoidID, Dimensions _radii) = 0; + const Identity &_ellipsoidID, const Dimensions &_radii) = 0; }; }; @@ -109,7 +109,7 @@ namespace gz /// \returns a ShapePtrType to the newly constructed EllipsoidShape public: ShapePtrType AttachEllipsoidShape( const std::string &_name = "ellipsoid", - Dimensions _radii = Dimensions::Constant(1.0), + const Dimensions &_radii = Dimensions::Constant(1.0), const PoseType &_pose = PoseType::Identity()); }; @@ -125,7 +125,7 @@ namespace gz public: virtual Identity AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - Dimensions _radii, + const Dimensions &_radii, const PoseType &_pose) = 0; }; }; diff --git a/include/gz/physics/detail/EllipsoidShape.hh b/include/gz/physics/detail/EllipsoidShape.hh index 0eaada733..3b3df8cfe 100644 --- a/include/gz/physics/detail/EllipsoidShape.hh +++ b/include/gz/physics/detail/EllipsoidShape.hh @@ -37,7 +37,7 @@ namespace gz ///////////////////////////////////////////////// template void SetEllipsoidShapeProperties::EllipsoidShape - ::SetRadii(Dimensions _radii) + ::SetRadii(const Dimensions &_radii) { this->template Interface() ->SetEllipsoidShapeRadii(this->identity, _radii); @@ -48,7 +48,7 @@ namespace gz auto AttachEllipsoidShapeFeature::Link ::AttachEllipsoidShape( const std::string &_name, - Dimensions _radii, + const Dimensions &_radii, const PoseType &_pose) -> ShapePtrType { return ShapePtrType(this->pimpl, diff --git a/tpe/plugin/src/ShapeFeatures.cc b/tpe/plugin/src/ShapeFeatures.cc index 1caf408c2..c01b0b9c4 100644 --- a/tpe/plugin/src/ShapeFeatures.cc +++ b/tpe/plugin/src/ShapeFeatures.cc @@ -272,7 +272,7 @@ Vector3d ShapeFeatures::GetEllipsoidShapeRadii( Identity ShapeFeatures::AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) { auto it = this->links.find(_linkID); diff --git a/tpe/plugin/src/ShapeFeatures.hh b/tpe/plugin/src/ShapeFeatures.hh index bdc89130b..3fe7a4dab 100644 --- a/tpe/plugin/src/ShapeFeatures.hh +++ b/tpe/plugin/src/ShapeFeatures.hh @@ -116,7 +116,7 @@ class ShapeFeatures : public: Identity AttachEllipsoidShape( const Identity &_linkID, const std::string &_name, - Vector3d _radii, + const Vector3d &_radii, const Pose3d &_pose) override; // ----- Sphere Features -----