Gazebo Math

API Reference

8.1.0
Ellipsoid< Precision > Class Template Reference

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 MaterialMat () 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< PrecisionRadii () 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

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
PrecisionScalar numeric type.

Constructor & Destructor Documentation

◆ Ellipsoid() [1/3]

template<typename Precision >
Ellipsoid ( )
default

Default constructor. The default radius and length are both zero.

◆ Ellipsoid() [2/3]

template<typename Precision >
Ellipsoid ( const Vector3< Precision > &  _radii)
explicit

Construct a ellipsoid with a Vector3 of three radii.

Parameters
[in]_radiiThe three radii (x, y, z) defining this ellipsoid

◆ Ellipsoid() [3/3]

template<typename Precision >
Ellipsoid ( const Vector3< Precision > &  _radii,
const Material _mat 
)

Construct a ellipsoid with three radii and a material.

Parameters
[in]_radiiThe three radii (x, y, z) defining this ellipsoid
[in]_matMaterial property for the ellipsoid.

Member Function Documentation

◆ DensityFromMass()

template<typename Precision >
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]_massMass 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()

template<typename Precision >
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()

template<typename Precision >
const Material & Mat ( ) const

Get the material associated with this ellipsoid.

Returns
The material assigned to this ellipsoid

◆ operator==()

template<typename Precision >
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()

template<typename Precision >
Vector3< Precision > Radii ( ) const

Get the radius in meters.

Returns
The radius of the ellipsoid in meters.

◆ SetDensityFromMass()

template<typename Precision >
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]_massMass 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()

template<typename Precision >
void SetMat ( const Material _mat)

Set the material associated with this ellipsoid.

Parameters
[in]_matThe material assigned to this ellipsoid

◆ SetRadii()

template<typename Precision >
void SetRadii ( const Vector3< Precision > &  _radii)

Set the radius in meters.

Parameters
[in]_radiiThe radii of the ellipsoid in meters.

◆ Volume()

template<typename Precision >
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: