Gazebo Math

API Reference

7.5.1
gz/math/Cylinder.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_CYLINDER_HH_
18 #define GZ_MATH_CYLINDER_HH_
19 
20 #include <optional>
21 #include "gz/math/MassMatrix3.hh"
22 #include "gz/math/Material.hh"
23 #include "gz/math/Quaternion.hh"
24 
25 namespace gz::math
26 {
27  // Foward declarations
28  class CylinderPrivate;
29 
30  // Inline bracket to help doxygen filtering.
31  inline namespace GZ_MATH_VERSION_NAMESPACE {
32  //
41  template<typename Precision>
42  class Cylinder
43  {
47  public: Cylinder() = default;
48 
54  public: Cylinder(const Precision _length, const Precision _radius,
55  const Quaternion<Precision> &_rotOffset =
57 
64  public: Cylinder(const Precision _length, const Precision _radius,
65  const Material &_mat,
66  const Quaternion<Precision> &_rotOffset =
68 
71  public: Precision Radius() const;
72 
75  public: void SetRadius(const Precision _radius);
76 
79  public: Precision Length() const;
80 
83  public: void SetLength(const Precision _length);
84 
90  public: Quaternion<Precision> RotationalOffset() const;
91 
96  public: void SetRotationalOffset(
97  const Quaternion<Precision> &_rotOffset);
98 
101  public: const Material &Mat() const;
102 
105  public: void SetMat(const Material &_mat);
106 
115  public: bool MassMatrix(MassMatrix3d &_massMat) const;
116 
123  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
124 
127  public: bool operator==(const Cylinder &_cylinder) const;
128 
131  public: Precision Volume() const;
132 
141  public: Precision DensityFromMass(const Precision _mass) const;
142 
155  public: bool SetDensityFromMass(const Precision _mass);
156 
158  private: Precision radius = 0.0;
159 
161  private: Precision length = 0.0;
162 
164  private: Material material;
165 
167  private: Quaternion<Precision> rotOffset =
169  };
170 
174 
178 
182  } // namespace GZ_MATH_VERSION_NAMESPACE
183 } // namespace gz::math
184 #include "gz/math/detail/Cylinder.hh"
185 #endif // GZ_MATH_CYLINDER_HH_
dc77db3616641a"> 155  public: bool SetDensityFromMass(const Precision _mass);
156 
158  private: Precision radius = 0.0;
159 
161  private: Precision length = 0.0;
162 
164  private: Material material;
165 
167  private: Quaternion<Precision> rotOffset =
168  Quaternion<Precision>::Identity;
169  };
170 
173  typedef Cylinder<int> Cylinderi;
174 
177  typedef Cylinder<double> Cylinderd;
178 
181  typedef Cylinder<float> Cylinderf;
182  } // namespace GZ_MATH_VERSION_NAMESPACE
183 } // namespace gz::math
184 #include "gz/math/detail/Cylinder.hh"
185 #endif // GZ_MATH_CYLINDER_HH_