Gazebo Math

API Reference

7.5.1
gz/math/Capsule.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 #ifndef GZ_MATH_CAPSULE_HH_
18 #define GZ_MATH_CAPSULE_HH_
19 
20 #include <optional>
21 #include "gz/math/MassMatrix3.hh"
22 #include "gz/math/Material.hh"
23 
24 namespace gz::math
25 {
26  // Foward declarations
27  class CapsulePrivate;
28 
29  // Inline bracket to help doxygen filtering.
30  inline namespace GZ_MATH_VERSION_NAMESPACE {
31  //
40  template<typename Precision>
41  class Capsule
42  {
45  public: Capsule() = default;
46 
50  public: Capsule(const Precision _length, const Precision _radius);
51 
56  public: Capsule(const Precision _length, const Precision _radius,
57  const Material &_mat);
58 
61  public: Precision Radius() const;
62 
65  public: void SetRadius(const Precision _radius);
66 
69  public: Precision Length() const;
70 
73  public: void SetLength(const Precision _length);
74 
77  public: const Material &Mat() const;
78 
81  public: void SetMat(const Material &_mat);
82 
89  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
90 
93  public: bool operator==(const Capsule &_capsule) const;
94 
97  public: Precision Volume() const;
98 
107  public: Precision DensityFromMass(const Precision _mass) const;
108 
121  public: bool SetDensityFromMass(const Precision _mass);
122 
124  private: Precision radius = 0.0;
125 
127  private: Precision length = 0.0;
128 
130  private: Material material;
131  };
132 
136 
140 
144  } // namespace GZ_MATH_VERSION_NAMESPACE
145 } // namespace gz::math
146 #include "gz/math/detail/Capsule.hh"
147 #endif // GZ_MATH_CAPSULE_HH_