Drake
GeometrySet Class Reference

The GeometrySet, as its name implies, is a convenience class for defining a set of geometries. More...

#include <drake/geometry/geometry_set.h>

Public Member Functions

 GeometrySet ()=default
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 GeometrySet (const GeometrySet &)=default
 
GeometrySetoperator= (const GeometrySet &)=default
 
 GeometrySet (GeometrySet &&)=default
 
GeometrySetoperator= (GeometrySet &&)=default
 
Explicit constructors

Various workflows may arise for operating on GeometrySet instances, e.g.

:

// Perform operation on previously existing collection of frame ids.
std::vector<FrameId> my_ids{...}; // Previously-defined vector of ids.
GeometrySet geometry_set;
geometry_set.Add(my_ids);
UnaryOperation(geometry_set);

or

// Perform operation between two frames.
set1.add(frame1);
set2.add(frame2);
BinaryOperation(set1, set2);

This set of constructors allow on-the-fly construction at the call site to create temporary instances when the group membership is a single id or a previously existing id. By doing so, the above cases become:

// Perform operation on previously existing collection of frame ids.
std::vector<FrameId> my_ids{...}; // Previously-defined vector of ids.
UnaryOperation(GeometrySet(my_ids));
// Perform operation between two frames.
BinaryOperation(GeometrySet(frame1), GeometrySet(frame2));

The following are all valid constructions – this is not an exhaustive list but a representative sampling:

// Assume that g_* and f_* are valid GeometryId and FrameId instances,
// respectively.
std::vector<GeometryId> g_vector{g_0, g_1, g_2};
std::set<GeometryId> g_set{g_3, g_4, g_5};
std::unordered_set<FrameId> f_set{f_0, f_1};
auto f_list = {f_2, f_3, f_4};
GeometrySet({g_0, g_1});
GeometrySet({f_0, f_1});
GeometrySet(g_vector, f_set);
GeometrySet(g_set, f_list);
// Note: construction on values of both geometry and frame identifiers
// requires passing in "collections" of ids; the initializer list is the
// simplest collection that serves the purpose. When both are provided,
// GeometryId always comes before FrameId.
GeometrySet({g_0}, {f_1});
GeometrySet({g_0}, f_set);
// etc.
 GeometrySet (GeometryId id)
 
 GeometrySet (FrameId id)
 
template<typename Container >
 GeometrySet (const Container &ids)
 
template<typename Id >
 GeometrySet (std::initializer_list< Id > id_list)
 
template<typename Container >
 GeometrySet (std::initializer_list< GeometryId > geometries, const Container &frames)
 
template<typename Container >
 GeometrySet (const Container &geometries, std::initializer_list< FrameId > frames)
 
 GeometrySet (std::initializer_list< GeometryId > geometries, std::initializer_list< FrameId > frames)
 

Detailed Description

The GeometrySet, as its name implies, is a convenience class for defining a set of geometries.

What makes it unique from a simple std::set<GeometryId> instance is that membership doesn't require explicit GeometryId enumeration; GeometryId values can be added to the set by adding the FrameId for the frame to which the geometries are rigidly affixed.

This class does no validation; it is a simple collection. Ultimately, it serves as the operand of SceneGraph operations (e.g., SceneGraph::ExcludeCollisionsWithin()). If the operation has a particular prerequisite on the members of a GeometrySet, it is the operation's responsibility to enforce that requirement.

More formally, the SceneGraph consists of a set of geometries, each associated with a unique identifier. As such, we can consider the set of all identifiers SG = {g₀, g₁, ..., gₙ} that belong to a SceneGraph. A GeometrySet should represent a subset of those identifiers, Gₛ ⊆ SG. The convenience of the GeometrySet class is how the subset is defined. Given a set of frame ids F = {f₀, f₁, ..., fₙ} and geometry ids G = {g₀, g₁, ..., gₘ}, Gₛ = G ⋃ geometry(f₀) ⋃ ... ⋃ geometry(fₙ) (where geometry(f) is the set of geometries rigidly affixed to frame f).

Constructor & Destructor Documentation

GeometrySet ( const GeometrySet )
default
GeometrySet ( GeometrySet &&  )
default
GeometrySet ( )
default
GeometrySet ( GeometryId  id)
inlineexplicit
GeometrySet ( FrameId  id)
inlineexplicit
GeometrySet ( const Container &  ids)
inlineexplicit
GeometrySet ( std::initializer_list< Id >  id_list)
inlineexplicit
GeometrySet ( std::initializer_list< GeometryId geometries,
const Container &  frames 
)
inlineexplicit
GeometrySet ( const Container &  geometries,
std::initializer_list< FrameId frames 
)
inlineexplicit
GeometrySet ( std::initializer_list< GeometryId geometries,
std::initializer_list< FrameId frames 
)
inlineexplicit

Member Function Documentation

GeometrySet& operator= ( const GeometrySet )
default
GeometrySet& operator= ( GeometrySet &&  )
default

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