Gazebo Math

API Reference

7.6.0
gz/math/Ellipsoid.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_ELLIPSOID_HH_
18 #define GZ_MATH_ELLIPSOID_HH_
19 
20 #include <optional>
21 #include "gz/math/MassMatrix3.hh"
22 #include "gz/math/Material.hh"
23 #include "gz/math/Plane.hh"
24 
25 namespace gz::math
26 {
27  // Inline bracket to help doxygen filtering.
28  inline namespace GZ_MATH_VERSION_NAMESPACE {
29  //
43  template<typename Precision>
44  class Ellipsoid
45  {
48  public: Ellipsoid() = default;
49 
52  public: explicit Ellipsoid(const Vector3<Precision> &_radii);
53 
57  public: Ellipsoid(const Vector3<Precision> &_radii,
58  const Material &_mat);
59 
62  public: Vector3<Precision> Radii() const;
63 
66  public: void SetRadii(const Vector3<Precision> &_radii);
67 
70  public: const Material &Mat() const;
71 
74  public: void SetMat(const Material &_mat);
75 
82  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
83 
86  public: bool operator==(const Ellipsoid &_ellipsoid) const;
87 
90  public: Precision Volume() const;
91 
97  public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
98 
106  public: std::optional<Vector3<Precision>>
107  CenterOfVolumeBelow(const Plane<Precision> &_plane) const;
108 
113  public: Vector3<Precision> Centroid() const;
114 
123  public: Precision DensityFromMass(const Precision _mass) const;
124 
137  public: bool SetDensityFromMass(const Precision _mass);
138 
141 
143  private: Material material;
144  };
145 
149 
153 
157  } // namespace GZ_MATH_VERSION_NAMESPACE
158 } // namespace gz::math
159 #include "gz/math/detail/Ellipsoid.hh"
160 #endif // GZ_MATH_ELLIPSOID_HH_