Gazebo Math

API Reference

7.5.1
Cone.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2024 CogniPilot Foundation
3  * Copyright 2024 Open Source Robotics Foundation
4  * Copyright 2024 Rudis Laboratories
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18 */
19 #ifndef GZ_MATH_CONE_HH_
20 #define GZ_MATH_CONE_HH_
21 
22 #include <optional>
23 #include "gz/math/MassMatrix3.hh"
24 #include "gz/math/Material.hh"
25 #include "gz/math/Quaternion.hh"
26 
27 namespace gz::math
28 {
29  // Foward declarations
30  class ConePrivate;
31 
32  // Inline bracket to help doxygen filtering.
33  inline namespace GZ_MATH_VERSION_NAMESPACE {
34  //
44  template<typename Precision>
45  class Cone
46  {
50  public: Cone() = default;
51 
57  public: Cone(const Precision _length, const Precision _radius,
58  const Quaternion<Precision> &_rotOffset =
60 
67  public: Cone(const Precision _length, const Precision _radius,
68  const Material &_mat,
69  const Quaternion<Precision> &_rotOffset =
71 
74  public: Precision Radius() const;
75 
78  public: void SetRadius(const Precision _radius);
79 
82  public: Precision Length() const;
83 
86  public: void SetLength(const Precision _length);
87 
93  public: Quaternion<Precision> RotationalOffset() const;
94 
100  public: void SetRotationalOffset(
101  const Quaternion<Precision> &_rotOffset);
102 
105  public: const Material &Mat() const;
106 
109  public: void SetMat(const Material &_mat);
110 
119  public: bool MassMatrix(MassMatrix3d &_massMat) const;
120 
127  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
128 
131  public: bool operator==(const Cone &_cone) const;
132 
135  public: Precision Volume() const;
136 
145  public: Precision DensityFromMass(const Precision _mass) const;
146 
159  public: bool SetDensityFromMass(const Precision _mass);
160 
162  private: Precision radius = 0.0;
163 
165  private: Precision length = 0.0;
166 
168  private: Material material;
169 
171  private: Quaternion<Precision> rotOffset =
173  };
174 
177  typedef Cone<int> Conei;
178 
182 
186  } // namespace GZ_MATH_VERSION_NAMESPACE
187 } // namespace gz::math
188 #include "gz/math/detail/Cone.hh"
189 #endif // GZ_MATH_CONE_HH_
#a4a6fbe08af3c4be27fdc77db3616641a" title="Set the density of this cone based on a mass value. Density is computed using Precision DensityFromMa...">SetDensityFromMass(const Precision _mass);
160 
162  private: Precision radius = 0.0;
163 
165  private: Precision length = 0.0;
166 
168  private: Material material;
169 
171  private: Quaternion<Precision> rotOffset =
172  Quaternion<Precision>::Identity;
173  };
174 
177  typedef Cone<int> Conei;
178 
181  typedef Cone<double> Coned;
182 
185  typedef Cone<float> Conef;
186  } // namespace GZ_MATH_VERSION_NAMESPACE
187 } // namespace gz::math
188 #include "gz/math/detail/Cone.hh"
189 #endif // GZ_MATH_CONE_HH_