# Ignition Math

## API Reference

6.9.3~pre2
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...

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
 Precision Scalar numeric type.

## ◆ 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

## ◆ Ellipsoid() [3/3]

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

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.

## ◆ 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 > 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.

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.
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

Parameters