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. | |
Ellipsoid (const Vector3< Precision > &_radii) | |
Construct a ellipsoid with a Vector3 of three radii. | |
Ellipsoid (const Vector3< Precision > &_radii, const Material &_mat) | |
Construct a ellipsoid with three radii and a material. | |
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. | |
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. | |
const Material & | Mat () const |
Get the material associated with this ellipsoid. | |
bool | operator== (const Ellipsoid &_ellipsoid) const |
Check if this ellipsoid is equal to the provided ellipsoid. Radius, length, and material properties will be checked. | |
Vector3< Precision > | Radii () const |
Get the radius in meters. | |
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. | |
void | SetMat (const Material &_mat) |
Set the material associated with this ellipsoid. | |
void | SetRadii (const Vector3< Precision > &_radii) |
Set the radius in meters. | |
Precision | Volume () const |
Get the volume of the ellipsoid in m^3. | |
Detailed Description
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 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()
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()
Get the material associated with this ellipsoid.
- Returns
- The material assigned to this ellipsoid
◆ operator==()
Check if this ellipsoid is equal to the provided ellipsoid. Radius, length, and material properties will be checked.
◆ Radii()
Get the radius in meters.
- Returns
- The radius of the ellipsoid in meters.
◆ SetDensityFromMass()
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()
Set the material associated with this ellipsoid.
- Parameters
-
[in] _mat The material assigned to this ellipsoid
◆ SetRadii()
Set the radius in meters.
- Parameters
-
[in] _radii The radii of the ellipsoid in meters.
◆ Volume()
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: