Gazebo Math

API Reference

6.15.1
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 
24 namespace ignition
25 {
26  namespace math
27  {
28  // Inline bracket to help doxygen filtering.
29  inline namespace IGNITION_MATH_VERSION_NAMESPACE {
30  //
38  template<typename Precision>
39  class Ellipsoid
40  {
43  public: Ellipsoid() = default;
44 
47  public: explicit Ellipsoid(const Vector3<Precision> &_radii);
48 
52  public: Ellipsoid(const Vector3<Precision> &_radii,
53  const Material &_mat);
54 
57  public: Vector3<Precision> Radii() const;
58 
61  public: void SetRadii(const Vector3<Precision> &_radii);
62 
65  public: const Material &Mat() const;
66 
69  public: void SetMat(const Material &_mat);
70 
77  public: std::optional< MassMatrix3<Precision> > MassMatrix() const;
78 
81  public: bool operator==(const Ellipsoid &_ellipsoid) const;
82 
85  public: Precision Volume() const;
86 
95  public: Precision DensityFromMass(const Precision _mass) const;
96 
109  public: bool SetDensityFromMass(const Precision _mass);
110 
113 
115  private: Material material;
116  };
117 
121 
125 
129  }
130  }
131 }
132 #include "gz/math/detail/Ellipsoid.hh"
133 
134 #endif
std::optional< MassMatrix3< Precision > > MassMatrix() const
Get the mass matrix for this ellipsoid. This function is only meaningful if the ellipsoid's radii and...
Definition: gz/math/AdditivelySeparableScalarField3.hh:27
Contains information about a single material.
Definition: gz/math/Material.hh:65
bool operator==(const Ellipsoid &_ellipsoid) const
Check if this ellipsoid is equal to the provided ellipsoid. Radius, length, and material properties w...
const Material & Mat() const
Get the material associated with this ellipsoid.
Vector3< Precision > Radii() const
Get the radius in meters.
Precision Volume() const
Get the volume of the ellipsoid in m^3.
bool SetDensityFromMass(const Precision _mass)
Set the density of this ellipsoid based on a mass value. Density is computed using Precision DensityF...
Ellipsoid< double > Ellipsoidd
Ellipsoid with double precision.
Definition: gz/math/Ellipsoid.hh:124
void SetMat(const Material &_mat)
Set the material associated with this ellipsoid.
A representation of a general ellipsoid.
Definition: gz/math/Ellipsoid.hh:39
Ellipsoid< int > Ellipsoidi
Ellipsoid with integer precision.
Definition: gz/math/Ellipsoid.hh:120
Ellipsoid()=default
Default constructor. The default radius and length are both zero.
Precision DensityFromMass(const Precision _mass) const
Compute the ellipsoid's density given a mass value. The ellipsoid is assumed to be solid with uniform...
void SetRadii(const Vector3< Precision > &_radii)
Set the radius in meters.
Ellipsoid< float > Ellipsoidf
Ellipsoid with float precision.
Definition: gz/math/Ellipsoid.hh:128