Gazebo Math

API Reference

7.4.0

Contains information about a single material. More...

#include <Material.hh>

Public Member Functions

 Material ()
 Constructor. More...
 
 Material (const double _density)
 Construct a material based on a density value. More...
 
 Material (const MaterialType _type)
 Construct a material based on a type. More...
 
 Material (const std::string &_typename)
 Construct a material based on a type name. More...
 
double Density () const
 Get the density value of the material in kg/m^3. More...
 
std::string Name () const
 Get the name of the material. This will match the enum type names used in MaterialType, but in lowercase, if a built-in material is used. More...
 
bool operator!= (const Material &_material) const
 Inequality operator. This compares type and density values. More...
 
bool operator== (const Material &_material) const
 Equality operator. This compares type and density values. More...
 
void SetDensity (const double _density)
 Set the density value of the material in kg/m^3. More...
 
void SetName (const std::string &_name)
 Set the name of the material. More...
 
void SetToNearestDensity (const double _value, const double _epsilon=std::numeric_limits< double >::max())
 Set this Material to the built-in Material with the nearest density value within _epsilon. If a built-in material could not be found, then this Material is not changed. More...
 
void SetType (const MaterialType _type)
 Set the material's type. This will only set the type value. Other properties, such as density, will not be changed. More...
 
MaterialType Type () const
 Get the material's type. More...
 

Static Public Member Functions

static const std::map< MaterialType, Material > & Predefined ()
 Get all the built-in materials. More...
 

Detailed Description

Contains information about a single material.

Steel, wood, and iron are examples of materials. This class allows you to create custom materials, or use built-in materials. The list of built-in materials can be found in the MaterialType enum.

This class will replace the MaterialDensity class found in the Gazebo Common library, which was at version 1 at the time of this writing.

How to create a wood material:

std::cout << "The density of " << mat.Name() << " is "
<< mat.Density() << std::endl;

How to create a custom material:

mat.SetDensity(12.23);
mat.SetName("my_material");
std::cout << "The density of " << mat.Name() is "
<< mat.Density() << std::endl;

Constructor & Destructor Documentation

◆ Material() [1/4]

Material ( )

Constructor.

◆ Material() [2/4]

Material ( const MaterialType  _type)
explicit

Construct a material based on a type.

Parameters
[in]_typeBuilt-in type to create.

◆ Material() [3/4]

Material ( const std::string _typename)
explicit

Construct a material based on a type name.

Parameters
[in]_typenameName of the built-in type to create. String names are listed in the MaterialType documentation.

◆ Material() [4/4]

Material ( const double  _density)
explicit

Construct a material based on a density value.

Parameters
[in]_densityMaterial density.

Member Function Documentation

◆ Density()

double Density ( ) const

Get the density value of the material in kg/m^3.

Returns
The density of this material in kg/m^3.

Referenced by MassMatrix3< T >::SetFromBox(), MassMatrix3< T >::SetFromCylinderZ(), and MassMatrix3< T >::SetFromSphere().

◆ Name()

std::string Name ( ) const

Get the name of the material. This will match the enum type names used in MaterialType, but in lowercase, if a built-in material is used.

Returns
The material's name.
See also
void SetName(const std::string &_name)

◆ operator!=()

bool operator!= ( const Material _material) const

Inequality operator. This compares type and density values.

Parameters
[in]_materialMaterial to evaluate this object against.
Returns
True if this material is not equal to the given _material.

◆ operator==()

bool operator== ( const Material _material) const

Equality operator. This compares type and density values.

Parameters
[in]_materialMaterial to evaluate this object against.
Returns
True if this material is equal to the given _material.

◆ Predefined()

static const std::map<MaterialType, Material>& Predefined ( )
static

Get all the built-in materials.

Returns
A map of all the materials. The map's key is material type and the map's value is the material object.

◆ SetDensity()

void SetDensity ( const double  _density)

Set the density value of the material in kg/m^3.

Parameters
[in]_densityThe density of this material in kg/m^3.

Referenced by OrientedBox< T >::SetDensityFromMass().

◆ SetName()

void SetName ( const std::string _name)

Set the name of the material.

Parameters
[in]_nameThe material's name.
See also
std::string Name() const

◆ SetToNearestDensity()

void SetToNearestDensity ( const double  _value,
const double  _epsilon = std::numeric_limits< double >::max() 
)

Set this Material to the built-in Material with the nearest density value within _epsilon. If a built-in material could not be found, then this Material is not changed.

Parameters
[in]_valueDensity value of entry to match.
[in]_epsilonAllowable range of difference between _value, and a material's density.

◆ SetType()

void SetType ( const MaterialType  _type)

Set the material's type. This will only set the type value. Other properties, such as density, will not be changed.

Parameters
[in]_typeThe material's type.

◆ Type()

MaterialType Type ( ) const

Get the material's type.

Returns
The material's type.

The documentation for this class was generated from the following file: