A representation of a general ellipsoid. More...
#include <gz/math/Ellipsoid.hh>
Public Member Functions | |
Ellipsoid ()=default | |
Default constructor. The default radius and length are both zero. More... | |
Ellipsoid (const Vector3< Precision > &_radii) | |
Construct a ellipsoid with a Vector3 of three radii. More... | |
Ellipsoid (const Vector3< Precision > &_radii, const Material &_mat) | |
Construct a ellipsoid with three radii and a material. More... | |
Precision | DensityFromMass (const Precision _mass) const |
Compute the ellipsoid's density given a mass value. The ellipsoid is assumed to be solid with uniform density. This function requires the ellipsoid's radius and length to be set to values greater than zero. The Material of the ellipsoid is ignored. More... | |
std::optional< MassMatrix3< Precision > > | MassMatrix () const |
Get the mass matrix for this ellipsoid. This function is only meaningful if the ellipsoid's radii and material have been set. More... | |
const Material & | Mat () const |
Get the material associated with this ellipsoid. More... | |
bool | operator== (const Ellipsoid &_ellipsoid) const |
Check if this ellipsoid is equal to the provided ellipsoid. Radius, length, and material properties will be checked. More... | |
Vector3< Precision > | Radii () const |
Get the radius in meters. More... | |
bool | SetDensityFromMass (const Precision _mass) |
Set the density of this ellipsoid based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The ellipsoid is assumed to be solid with uniform density. This function requires the ellipsoid's radius and length to be set to values greater than zero. The existing Material density value is overwritten only if the return value from this true. More... | |
void | SetMat (const Material &_mat) |
Set the material associated with this ellipsoid. More... | |
void | SetRadii (const Vector3< Precision > &_radii) |
Set the radius in meters. More... | |
Precision | Volume () const |
Get the volume of the ellipsoid in m^3. More... | |
Detailed Description
template<typename Precision>
class gz::math::Ellipsoid< Precision >
A representation of a general ellipsoid.
The ellipsoid class supports defining a ellipsoid with three radii and material properties. Radii are in meters. See Material for more on material properties.
- Template Parameters
-
Precision Scalar numeric type.
Constructor & Destructor Documentation
◆ Ellipsoid() [1/3]
|
default |
Default constructor. The default radius and length are both zero.
◆ Ellipsoid() [2/3]
Construct a ellipsoid with a Vector3 of three radii.
- Parameters
-
[in] _radii The three radii (x, y, z) defining this ellipsoid
◆ Ellipsoid() [3/3]
Construct a ellipsoid with three radii and a material.
- Parameters
-
[in] _radii The three radii (x, y, z) defining this ellipsoid [in] _mat Material property for the ellipsoid.
Member Function Documentation
◆ DensityFromMass()
Precision DensityFromMass | ( | const Precision | _mass | ) | const |
Compute the ellipsoid's density given a mass value. The ellipsoid is assumed to be solid with uniform density. This function requires the ellipsoid's radius and length to be set to values greater than zero. The Material of the ellipsoid is ignored.
- Parameters
-
[in] _mass Mass of the ellipsoid, in kg. This value should be greater than zero.
- Returns
- Density of the ellipsoid in kg/m^3. A NaN is returned if radius, length or _mass is <= 0.
◆ MassMatrix()
std::optional< MassMatrix3<Precision> > MassMatrix | ( | ) | const |
Get the mass matrix for this ellipsoid. This function is only meaningful if the ellipsoid's radii and material have been set.
- Returns
- The computed mass matrix if parameters are valid (radius > 0), (length > 0), and (density > 0). Otherwise std::nullopt is returned.
◆ Mat()
const Material& Mat | ( | ) | const |
Get the material associated with this ellipsoid.
- Returns
- The material assigned to this ellipsoid
◆ operator==()
bool operator== | ( | const Ellipsoid< Precision > & | _ellipsoid | ) | const |
Check if this ellipsoid is equal to the provided ellipsoid. Radius, length, and material properties will be checked.
◆ Radii()
Vector3<Precision> Radii | ( | ) | const |
Get the radius in meters.
- Returns
- The radius of the ellipsoid in meters.
◆ SetDensityFromMass()
bool SetDensityFromMass | ( | const Precision | _mass | ) |
Set the density of this ellipsoid based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The ellipsoid is assumed to be solid with uniform density. This function requires the ellipsoid's radius and length to be set to values greater than zero. The existing Material density value is overwritten only if the return value from this true.
- Parameters
-
[in] _mass Mass of the ellipsoid, in kg. This value should be greater than zero.
- Returns
- True if the density was set. False is returned if the ellipsoid's radius, length, or the _mass value are <= 0.
- See also
- Precision DensityFromMass(const Precision _mass) const
◆ SetMat()
void SetMat | ( | const Material & | _mat | ) |
Set the material associated with this ellipsoid.
- Parameters
-
[in] _mat The material assigned to this ellipsoid
◆ SetRadii()
void SetRadii | ( | const Vector3< Precision > & | _radii | ) |
Set the radius in meters.
- Parameters
-
[in] _radii The radii of the ellipsoid in meters.
◆ Volume()
Precision Volume | ( | ) | const |
Get the volume of the ellipsoid in m^3.
- Returns
- Volume of the ellipsoid in m^3.
The documentation for this class was generated from the following file: