Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Mesh Class Reference

Mesh represents a mesh shape, and is usually accessed through a Geometry. More...

#include <Mesh.hh>

Public Member Functions

 Mesh ()
 Constructor. More...
 
std::optional< gz::math::Inertiald > CalculateInertial (sdf::Errors &_errors, double _density, const sdf::ElementPtr _autoInertiaParams, const ParserConfig &_config)
 Calculate and return the Inertial values for the Mesh. More...
 
bool CenterSubmesh () const
 Get whether the submesh should be centered at 0,0,0. More...
 
const sdf::ConvexDecompositionConvexDecomposition () const
 Get the associated ConvexDecomposition object. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
const std::string & FilePath () const
 The path to the file where this element was loaded from. More...
 
Errors Load (ElementPtr _sdf)
 Load the mesh geometry based on a element pointer. More...
 
Errors Load (sdf::ElementPtr _sdf, const ParserConfig &_config)
 Load the mesh geometry based on a element pointer. More...
 
MeshOptimization Optimization () const
 Get the mesh's optimization method. More...
 
std::string OptimizationStr () const
 Get the mesh's optimization method. More...
 
gz::math::Vector3d Scale () const
 Get the mesh's scale factor. More...
 
void SetCenterSubmesh (const bool _center)
 Set whether the submesh should be centered. More...
 
void SetConvexDecomposition (const sdf::ConvexDecomposition &_convexDecomposition)
 Set the associated ConvexDecomposition object. More...
 
void SetFilePath (const std::string &_filePath)
 Set the path to the file where this element was loaded from. More...
 
bool SetOptimization (const std::string &_optimizationStr)
 Set the mesh optimization method. More...
 
void SetOptimization (MeshOptimization _optimization)
 Set the mesh optimization method. More...
 
void SetScale (const gz::math::Vector3d &_scale)
 Set the mesh's scale factor. More...
 
void SetSubmesh (const std::string &_submesh)
 Set the mesh's submesh. More...
 
void SetUri (const std::string &_uri)
 Set the mesh's URI. More...
 
std::string Submesh () const
 A submesh, contained with the mesh at the specified URI, may optionally be specified. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this mesh. More...
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this mesh. More...
 
std::string Uri () const
 Get the mesh's URI. More...
 

Detailed Description

Mesh represents a mesh shape, and is usually accessed through a Geometry.

Constructor & Destructor Documentation

◆ Mesh()

sdf::SDF_VERSION_NAMESPACE::Mesh::Mesh ( )

Constructor.

Member Function Documentation

◆ CalculateInertial()

std::optional<gz::math::Inertiald> sdf::SDF_VERSION_NAMESPACE::Mesh::CalculateInertial ( sdf::Errors _errors,
double  _density,
const sdf::ElementPtr  _autoInertiaParams,
const ParserConfig _config 
)

Calculate and return the Inertial values for the Mesh.

Parameters
[out]_errorsA vector of Errors object. Each object would contain an error code and an error message.
[in]_densityDensity of the mesh in kg/m^3
[in]_autoInertiaParamsElementPtr to <auto_inertia_params> element
[in]_configParser Configuration
Returns
A std::optional with gz::math::Inertiald object or std::nullopt

◆ CenterSubmesh()

bool sdf::SDF_VERSION_NAMESPACE::Mesh::CenterSubmesh ( ) const

Get whether the submesh should be centered at 0,0,0.

This will effectively remove any transformations on the submesh before the poses from parent links and models are applied. The return value is only applicable if a SubMesh has been specified.

Returns
True if the submesh should be centered.

◆ ConvexDecomposition()

const sdf::ConvexDecomposition* sdf::SDF_VERSION_NAMESPACE::Mesh::ConvexDecomposition ( ) const

Get the associated ConvexDecomposition object.

Returns
Pointer to the associated ConvexDecomposition object, nullptr if the Mesh doesn't contain a ConvexDecomposition element.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Mesh::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ FilePath()

const std::string& sdf::SDF_VERSION_NAMESPACE::Mesh::FilePath ( ) const

The path to the file where this element was loaded from.

Returns
Full path to the file on disk.

◆ Load() [1/2]

Errors sdf::SDF_VERSION_NAMESPACE::Mesh::Load ( ElementPtr  _sdf)

Load the mesh geometry based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Load() [2/2]

Errors sdf::SDF_VERSION_NAMESPACE::Mesh::Load ( sdf::ElementPtr  _sdf,
const ParserConfig _config 
)

Load the mesh geometry based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
[in]_configParser configuration
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Optimization()

MeshOptimization sdf::SDF_VERSION_NAMESPACE::Mesh::Optimization ( ) const

Get the mesh's optimization method.

Returns
The mesh optimization method. MeshOptimization::NONE if no mesh simplificaton is done.

◆ OptimizationStr()

std::string sdf::SDF_VERSION_NAMESPACE::Mesh::OptimizationStr ( ) const

Get the mesh's optimization method.

Returns
The mesh optimization method. Empty string if no mesh simplificaton is done.

◆ Scale()

gz::math::Vector3d sdf::SDF_VERSION_NAMESPACE::Mesh::Scale ( ) const

Get the mesh's scale factor.

Returns
The mesh's scale factor.

◆ SetCenterSubmesh()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetCenterSubmesh ( const bool  _center)

Set whether the submesh should be centered.

See CenterSubmesh() for more information.

Parameters
[in]_centerTrue to center the submesh.

◆ SetConvexDecomposition()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetConvexDecomposition ( const sdf::ConvexDecomposition _convexDecomposition)

Set the associated ConvexDecomposition object.

Parameters
[in]_convexDecompositionThe ConvexDecomposition object.

◆ SetFilePath()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetFilePath ( const std::string &  _filePath)

Set the path to the file where this element was loaded from.

\paramp[in] _filePath Full path to the file on disk.

◆ SetOptimization() [1/2]

bool sdf::SDF_VERSION_NAMESPACE::Mesh::SetOptimization ( const std::string &  _optimizationStr)

Set the mesh optimization method.

Parameters
[in]_optimizationThe mesh optimization method.
Returns
True if the _optimizationStr parameter matched a known mesh optimization method. False if the mesh optimization method could not be set.

◆ SetOptimization() [2/2]

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetOptimization ( MeshOptimization  _optimization)

Set the mesh optimization method.

Parameters
[in]_optimizationThe mesh optimization method.

◆ SetScale()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetScale ( const gz::math::Vector3d &  _scale)

Set the mesh's scale factor.

Returns
The mesh's scale factor.

◆ SetSubmesh()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetSubmesh ( const std::string &  _submesh)

Set the mesh's submesh.

See Submesh() for more information.

Parameters
[in]_submeshName of the submesh. The name should match a submesh within the mesh at the specified URI.

◆ SetUri()

void sdf::SDF_VERSION_NAMESPACE::Mesh::SetUri ( const std::string &  _uri)

Set the mesh's URI.

Parameters
[in]_uriThe URI of the mesh.

◆ Submesh()

std::string sdf::SDF_VERSION_NAMESPACE::Mesh::Submesh ( ) const

A submesh, contained with the mesh at the specified URI, may optionally be specified.

If specified, this submesh should be used instead of the entire mesh.

Returns
The name of the submesh within the mesh at the specified URI.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Mesh::ToElement ( ) const

Create and return an SDF element filled with data from this mesh.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated mesh values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Mesh::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this mesh.

Note that parameter passing functionality is not captured with this function.

Parameters
[out]_errorsVector of errors.
Returns
SDF element pointer with updated mesh values.

◆ Uri()

std::string sdf::SDF_VERSION_NAMESPACE::Mesh::Uri ( ) const

Get the mesh's URI.

Returns
The URI of the mesh data.

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