Gazebo Math

API Reference

6.15.1
Ellipsoid< Precision > Class Template Reference

A representation of a general ellipsoid. More...

#include <ignition/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 MaterialMat () 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 ignition::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]

Ellipsoid ( )
default

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

◆ Ellipsoid() [2/3]

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]

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

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

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]_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()

void SetMat ( const Material _mat)

Set the material associated with this ellipsoid.

Parameters
[in]_matThe material assigned to this ellipsoid

◆ SetRadii()

void SetRadii ( const Vector3< Precision > &  _radii)

Set the radius in meters.

Parameters
[in]_radiiThe 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: