Gazebo Math

API Reference

7.6.0
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/Plane.hh"
26 #include "gz/math/Quaternion.hh"
27 
28 namespace gz::math
29 {
30  // Forward declarations
31  class ConePrivate;
32 
33  // Inline bracket to help doxygen filtering.
34  inline namespace GZ_MATH_VERSION_NAMESPACE {
35  //
49  template<typename Precision>
50  class Cone
51  {
55  public: Cone() = default;
56 
62  public: Cone(const Precision _length, const Precision _radius,
63  const Quaternion<Precision> &_rotOffset =
65 
72  public: Cone(const Precision _length, const Precision _radius,
73  const Material &_mat,
74  const Quaternion<Precision> &_rotOffset =
76 
79  public: Precision Radius() const;
80 
83  public: void SetRadius(const Precision _radius);
84 
87  public: Precision Length() const;
88 
91  public: void SetLength(const Precision _length);
92 
99 
105  public: void SetRotationalOffset(
106  const Quaternion<Precision> &_rotOffset);
107 
110  public: const Material &Mat() const;
111 
114  public: void SetMat(const Material &_mat);
115 
124  public: bool MassMatrix(MassMatrix3d &_massMat) const;
125 
132  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
133 
136  public: bool operator==(const Cone &_cone) const;
137 
140  public: Precision Volume() const;
141 
147  public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
148 
156  public: std::optional<Vector3<Precision>>
157  CenterOfVolumeBelow(const Plane<Precision> &_plane) const;
158 
167  public: Vector3<Precision> Centroid() const;
168 
177  public: Precision DensityFromMass(const Precision _mass) const;
178 
191  public: bool SetDensityFromMass(const Precision _mass);
192 
194  private: Precision radius = 0.0;
195 
197  private: Precision length = 0.0;
198 
200  private: Material material;
201 
203  private: Quaternion<Precision> rotOffset =
205  };
206 
209  typedef Cone<int> Conei;
210 
214 
218  } // namespace GZ_MATH_VERSION_NAMESPACE
219 } // namespace gz::math
220 #include "gz/math/detail/Cone.hh"
221 #endif // GZ_MATH_CONE_HH_