Gazebo Math

API Reference

7.5.2
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  //
37  template<typename Precision>
38  class Ellipsoid
39  {
42  public: Ellipsoid() = default;
43 
46  public: explicit Ellipsoid(const Vector3<Precision> &_radii);
47 
51  public: Ellipsoid(const Vector3<Precision> &_radii,
52  const Material &_mat);
53 
56  public: Vector3<Precision> Radii() const;
57 
60  public: void SetRadii(const Vector3<Precision> &_radii);
61 
64  public: const Material &Mat() const;
65 
68  public: void SetMat(const Material &_mat);
69 
76  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
77 
80  public: bool operator==(const Ellipsoid &_ellipsoid) const;
81 
84  public: Precision Volume() const;
85 
91  public: Precision VolumeBelow(const Plane<Precision> &_plane) const;
92 
100  public: std::optional<Vector3<Precision>>
101  CenterOfVolumeBelow(const Plane<Precision> &_plane) const;
102 
111  public: Precision DensityFromMass(const Precision _mass) const;
112 
125  public: bool SetDensityFromMass(const Precision _mass);
126 
129 
131  private: Material material;
132  };
133 
137 
141 
145  } // namespace GZ_MATH_VERSION_NAMESPACE
146 } // namespace gz::math
147 #include "gz/math/detail/Ellipsoid.hh"
148 #endif // GZ_MATH_ELLIPSOID_HH_