A representation of a sphere. More...
#include <ignition/math/Sphere.hh>
Public Member Functions  
Sphere ()=default  
Default constructor. The default radius is zero. More...  
Sphere (const Precision _radius)  
Construct a sphere with a radius. More...  
Sphere (const Precision _radius, const Material &_mat)  
Construct a sphere with a radius, material. More...  
~Sphere ()=default  
Destructor. More...  
Precision  DensityFromMass (const Precision _mass) const 
Compute the sphere's density given a mass value. The sphere is assumed to be solid with uniform density. This function requires the sphere's radius to be set to a value greater than zero. The Material of the sphere is ignored. More...  
bool  MassMatrix (MassMatrix3d &_massMat) const 
Get the mass matrix for this sphere. This function is only meaningful if the sphere's radius and material have been set. More...  
const Material &  Material () const 
Get the material associated with this sphere. More...  
bool  operator!= (const Sphere &_sphere) const 
Check if this sphere is not equal to the provided sphere. Radius and material properties will be checked. More...  
bool  operator== (const Sphere &_sphere) const 
Check if this sphere is equal to the provided sphere. Radius and material properties will be checked. More...  
Precision  Radius () const 
Get the radius in meters. More...  
bool  SetDensityFromMass (const Precision _mass) 
Set the density of this sphere based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The sphere is assumed to be solid with uniform density. This function requires the sphere's radius to be set to a value greater than zero. The existing Material density value is overwritten only if the return value from this true. More...  
void  SetMaterial (const Material &_mat) 
Set the material associated with this sphere. More...  
void  SetRadius (const Precision _radius) 
Set the radius in meters. More...  
Precision  Volume () const 
Get the volume of the sphere in m^3. More...  
Detailed Description
template<typename Precision>
class ignition::math::Sphere< Precision >
A representation of a sphere.
The sphere class supports defining a sphere with a radius and material properties. Radius is in meters. See Material for more on material properties.
Constructor & Destructor Documentation
◆ Sphere() [1/3]

default 
Default constructor. The default radius is zero.
◆ Sphere() [2/3]

explicit 
Construct a sphere with a radius.
 Parameters

[in] _radius Radius of the sphere.
◆ Sphere() [3/3]
Construct a sphere with a radius, material.
 Parameters

[in] _radius Radius of the sphere. [in] _mat Material property for the sphere.
◆ ~Sphere()

default 
Destructor.
Member Function Documentation
◆ DensityFromMass()
Precision DensityFromMass  (  const Precision  _mass  )  const 
Compute the sphere's density given a mass value. The sphere is assumed to be solid with uniform density. This function requires the sphere's radius to be set to a value greater than zero. The Material of the sphere is ignored.
 Parameters

[in] _mass Mass of the sphere, in kg. This value should be greater than zero.
 Returns
 Density of the sphere in kg/m^3. A negative value is returned if radius or _mass is <= 0.
◆ MassMatrix()
bool MassMatrix  (  MassMatrix3d &  _massMat  )  const 
Get the mass matrix for this sphere. This function is only meaningful if the sphere's radius and material have been set.
 Parameters

[out] _massMat The computed mass matrix will be stored here.
 Returns
 False if computation of the mass matrix failed, which could be due to an invalid radius (<=0) or density (<=0).
◆ Material()
Get the material associated with this sphere.
 Returns
 The material assigned to this sphere
◆ operator!=()
bool operator!=  (  const Sphere< Precision > &  _sphere  )  const 
Check if this sphere is not equal to the provided sphere. Radius and material properties will be checked.
◆ operator==()
bool operator==  (  const Sphere< Precision > &  _sphere  )  const 
Check if this sphere is equal to the provided sphere. Radius and material properties will be checked.
◆ Radius()
Precision Radius  (  )  const 
Get the radius in meters.
 Returns
 The radius of the sphere in meters.
◆ SetDensityFromMass()
bool SetDensityFromMass  (  const Precision  _mass  ) 
Set the density of this sphere based on a mass value. Density is computed using Precision DensityFromMass(const Precision _mass) const. The sphere is assumed to be solid with uniform density. This function requires the sphere's radius to be set to a value greater than zero. The existing Material density value is overwritten only if the return value from this true.
 Parameters

[in] _mass Mass of the sphere, in kg. This value should be greater than zero.
 Returns
 True if the density was set. False is returned if the sphere's radius or the _mass value are <= 0.
 See also
 Precision DensityFromMass(const Precision _mass) const
◆ SetMaterial()
void SetMaterial  (  const Material &  _mat  ) 
Set the material associated with this sphere.
 Parameters

[in] _mat The material assigned to this sphere
◆ SetRadius()
void SetRadius  (  const Precision  _radius  ) 
Set the radius in meters.
 Parameters

[in] _radius The radius of the sphere in meters.
◆ Volume()
Precision Volume  (  )  const 
Get the volume of the sphere in m^3.
 Returns
 Volume of the sphere in m^3.
The documentation for this class was generated from the following file: