Gazebo Math

API Reference

7.5.2
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  //
45  template<typename Precision>
46  class Cone
47  {
51  public: Cone() = default;
52 
58  public: Cone(const Precision _length, const Precision _radius,
59  const Quaternion<Precision> &_rotOffset =
61 
68  public: Cone(const Precision _length, const Precision _radius,
69  const Material &_mat,
70  const Quaternion<Precision> &_rotOffset =
72 
75  public: Precision Radius() const;
76 
79  public: void SetRadius(const Precision _radius);
80 
83  public: Precision Length() const;
84 
87  public: void SetLength(const Precision _length);
88 
95 
101  public: void SetRotationalOffset(
102  const Quaternion<Precision> &_rotOffset);
103 
106  public: const Material &Mat() const;
107 
110  public: void SetMat(const Material &_mat);
111 
120  public: bool MassMatrix(MassMatrix3d &_massMat) const;
121 
128  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
129 
132  public: bool operator==(const Cone &_cone) const;
133 
136  public: Precision Volume() const;
137 
143  public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
144 
152  public: std::optional<Vector3<Precision>>
153  CenterOfVolumeBelow(const Plane<Precision> &_plane) const;
154 
163  public: Precision DensityFromMass(const Precision _mass) const;
164 
177  public: bool SetDensityFromMass(const Precision _mass);
178 
180  private: Precision radius = 0.0;
181 
183  private: Precision length = 0.0;
184 
186  private: Material material;
187 
189  private: Quaternion<Precision> rotOffset =
191  };
192 
195  typedef Cone<int> Conei;
196 
200 
204  } // namespace GZ_MATH_VERSION_NAMESPACE
205 } // namespace gz::math
206 #include "gz/math/detail/Cone.hh"
207 #endif // GZ_MATH_CONE_HH_