Loading...
Searching...
No Matches
Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Geometry Class Reference

Geometry provides access to a shape, such as a Box. More...

#include <Geometry.hh>

Public Member Functions

 Geometry ()
 Default constructor.
 
const BoxBoxShape () const
 Get the box geometry, or nullptr if the contained geometry is not a box.
 
std::optional< gz::math::Inertiald > CalculateInertial (sdf::Errors &_errors, const ParserConfig &_config, double _density, sdf::ElementPtr _autoInertiaParams)
 Calculate and return the Inertial values for the Geometry.
 
const CapsuleCapsuleShape () const
 Get the capsule geometry, or nullptr if the contained geometry is not a capsule.
 
const ConeConeShape () const
 Get the cone geometry, or nullptr if the contained geometry is not a cone.
 
const CylinderCylinderShape () const
 Get the cylinder geometry, or nullptr if the contained geometry is not a cylinder.
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load.
 
const EllipsoidEllipsoidShape () const
 Get the ellipsoid geometry, or nullptr if the contained geometry is not an ellipsoid.
 
const HeightmapHeightmapShape () const
 Get the heightmap geometry, or nullptr if the contained geometry is not a heightmap.
 
Errors Load (ElementPtr _sdf)
 Load the geometry based on a element pointer.
 
Errors Load (sdf::ElementPtr _sdf, const ParserConfig &_config)
 Load the geometry based on a element pointer.
 
const MeshMeshShape () const
 Get the mesh geometry, or nullptr if the contained geometry is not a mesh.
 
const PlanePlaneShape () const
 Get the plane geometry, or nullptr if the contained geometry is not a plane.
 
const std::vector< Polyline > & PolylineShape () const
 Get the polyline geometry.
 
void SetBoxShape (const Box &_box)
 Set the box shape.
 
void SetCapsuleShape (const Capsule &_capsule)
 Set the capsule shape.
 
void SetConeShape (const Cone &_cone)
 Set the cone shape.
 
void SetCylinderShape (const Cylinder &_cylinder)
 Set the cylinder shape.
 
void SetEllipsoidShape (const Ellipsoid &_ellipsoid)
 Set the ellipsoid shape.
 
void SetHeightmapShape (const Heightmap &_heightmap)
 Set the heightmap shape.
 
void SetMeshShape (const Mesh &_mesh)
 Set the mesh shape.
 
void SetPlaneShape (const Plane &_plane)
 Set the plane shape.
 
void SetPolylineShape (const std::vector< Polyline > &_polyline)
 Set the polyline shape.
 
void SetSphereShape (const Sphere &_sphere)
 Set the sphere shape.
 
void SetType (const GeometryType _type)
 Set the type of geometry.
 
const SphereSphereShape () const
 Get the sphere geometry, or nullptr if the contained geometry is not a sphere.
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this geometry.
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this geometry.
 
GeometryType Type () const
 Get the type of geometry.
 

Detailed Description

Geometry provides access to a shape, such as a Box.

Use the Type function to determine the type of shape contained within a Geometry. Access to shape data, such as a box's size, is achieved through the shape accessors, such as const Box *BoxShape() const.

Constructor & Destructor Documentation

◆ Geometry()

sdf::SDF_VERSION_NAMESPACE::Geometry::Geometry ( )

Default constructor.

Member Function Documentation

◆ BoxShape()

const Box * sdf::SDF_VERSION_NAMESPACE::Geometry::BoxShape ( ) const

Get the box geometry, or nullptr if the contained geometry is not a box.

Returns
Pointer to the visual's box geometry, or nullptr if the geometry is not a box.
See also
GeometryType Type() const

◆ CalculateInertial()

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

Calculate and return the Inertial values for the Geometry.

Parameters
[out]_errorsA vector of Errors object. Each object would contain an error code and an error message.
[in]_configParser Config
[in]_densityThe density of the geometry element.
[in]_autoInertiaParamsElementPtr to <auto_inertia_params>
Returns
A std::optional with gz::math::Inertiald object or std::nullopt

◆ CapsuleShape()

const Capsule * sdf::SDF_VERSION_NAMESPACE::Geometry::CapsuleShape ( ) const

Get the capsule geometry, or nullptr if the contained geometry is not a capsule.

Returns
Pointer to the capsule geometry, or nullptr if the geometry is not a capsule.
See also
GeometryType Type() const

◆ ConeShape()

const Cone * sdf::SDF_VERSION_NAMESPACE::Geometry::ConeShape ( ) const

Get the cone geometry, or nullptr if the contained geometry is not a cone.

Returns
Pointer to the visual's cone geometry, or nullptr if the geometry is not a cone.
See also
GeometryType Type() const

◆ CylinderShape()

const Cylinder * sdf::SDF_VERSION_NAMESPACE::Geometry::CylinderShape ( ) const

Get the cylinder geometry, or nullptr if the contained geometry is not a cylinder.

Returns
Pointer to the visual's cylinder geometry, or nullptr if the geometry is not a cylinder.
See also
GeometryType Type() const

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Geometry::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.

◆ EllipsoidShape()

const Ellipsoid * sdf::SDF_VERSION_NAMESPACE::Geometry::EllipsoidShape ( ) const

Get the ellipsoid geometry, or nullptr if the contained geometry is not an ellipsoid.

Returns
Pointer to the ellipsoid geometry, or nullptr if the geometry is not an ellipsoid.
See also
GeometryType Type() const

◆ HeightmapShape()

const Heightmap * sdf::SDF_VERSION_NAMESPACE::Geometry::HeightmapShape ( ) const

Get the heightmap geometry, or nullptr if the contained geometry is not a heightmap.

Returns
Pointer to the heightmap geometry, or nullptr if the geometry is not a heightmap.
See also
GeometryType Type() const

◆ Load() [1/2]

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

Load the 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::Geometry::Load ( sdf::ElementPtr  _sdf,
const ParserConfig _config 
)

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

◆ MeshShape()

const Mesh * sdf::SDF_VERSION_NAMESPACE::Geometry::MeshShape ( ) const

Get the mesh geometry, or nullptr if the contained geometry is not a mesh.

Returns
Pointer to the visual's mesh geometry, or nullptr if the geometry is not a mesh.
See also
GeometryType Type() const

◆ PlaneShape()

const Plane * sdf::SDF_VERSION_NAMESPACE::Geometry::PlaneShape ( ) const

Get the plane geometry, or nullptr if the contained geometry is not a plane.

Returns
Pointer to the visual's plane geometry, or nullptr if the geometry is not a plane.
See also
GeometryType Type() const

◆ PolylineShape()

const std::vector< Polyline > & sdf::SDF_VERSION_NAMESPACE::Geometry::PolylineShape ( ) const

Get the polyline geometry.

Vector is empty if the contained geometry is not a polyline.

Returns
The visual's polyline geometries.
See also
GeometryType Type() const

◆ SetBoxShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetBoxShape ( const Box _box)

Set the box shape.

Parameters
[in]_boxThe box shape.

◆ SetCapsuleShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetCapsuleShape ( const Capsule _capsule)

Set the capsule shape.

Parameters
[in]_capsuleThe capsule shape.

◆ SetConeShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetConeShape ( const Cone _cone)

Set the cone shape.

Parameters
[in]_coneThe cone shape.

◆ SetCylinderShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetCylinderShape ( const Cylinder _cylinder)

Set the cylinder shape.

Parameters
[in]_cylinderThe cylinder shape.

◆ SetEllipsoidShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetEllipsoidShape ( const Ellipsoid _ellipsoid)

Set the ellipsoid shape.

Parameters
[in]_ellipsoidThe ellipsoid shape.

◆ SetHeightmapShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetHeightmapShape ( const Heightmap _heightmap)

Set the heightmap shape.

Parameters
[in]_heightmapThe heightmap shape.

◆ SetMeshShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetMeshShape ( const Mesh _mesh)

Set the mesh shape.

Parameters
[in]_meshThe mesh shape.

◆ SetPlaneShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetPlaneShape ( const Plane _plane)

Set the plane shape.

Parameters
[in]_planeThe plane shape.

◆ SetPolylineShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetPolylineShape ( const std::vector< Polyline > &  _polyline)

Set the polyline shape.

Parameters
[in]_polylineThe polyline shape.

◆ SetSphereShape()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetSphereShape ( const Sphere _sphere)

Set the sphere shape.

Parameters
[in]_sphereThe sphere shape.

◆ SetType()

void sdf::SDF_VERSION_NAMESPACE::Geometry::SetType ( const GeometryType  _type)

Set the type of geometry.

Parameters
[in]_typeThe geometry type.

◆ SphereShape()

const Sphere * sdf::SDF_VERSION_NAMESPACE::Geometry::SphereShape ( ) const

Get the sphere geometry, or nullptr if the contained geometry is not a sphere.

Returns
Pointer to the visual's sphere geometry, or nullptr if the geometry is not a sphere.
See also
GeometryType Type() const

◆ ToElement() [1/2]

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

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

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

Returns
SDF element pointer with updated geometry values.

◆ ToElement() [2/2]

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

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

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

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

◆ Type()

GeometryType sdf::SDF_VERSION_NAMESPACE::Geometry::Type ( ) const

Get the type of geometry.

Returns
The geometry type.

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