GeometrySet Class Reference

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).

#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;


// Perform operation between two frames.
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.
// 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 geometry_id)
 GeometrySet (FrameId frame_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 > geometry_ids, const Container &frame_ids)
template<typename Container >
 GeometrySet (const Container &geometry_ids, std::initializer_list< FrameId > frame_ids)
 GeometrySet (std::initializer_list< GeometryId > geometry_ids, std::initializer_list< FrameId > frame_ids)
template<typename ContainerG , typename ContainerF , typename = typename std::enable_if_t< std::is_same_v<typename ContainerG::value_type, GeometryId> && std::is_same_v<typename ContainerF::value_type, FrameId>>>
 GeometrySet (const ContainerG &geometry_ids, const ContainerF &frame_ids)

Constructor & Destructor Documentation

◆ GeometrySet() [1/11]

GeometrySet ( const GeometrySet )

◆ GeometrySet() [2/11]

GeometrySet ( GeometrySet &&  )

◆ GeometrySet() [3/11]

GeometrySet ( )

◆ GeometrySet() [4/11]

GeometrySet ( GeometryId  geometry_id)

◆ GeometrySet() [5/11]

GeometrySet ( FrameId  frame_id)

◆ GeometrySet() [6/11]

GeometrySet ( const Container &  ids)

◆ GeometrySet() [7/11]

GeometrySet ( std::initializer_list< Id >  id_list)

◆ GeometrySet() [8/11]

GeometrySet ( std::initializer_list< GeometryId geometry_ids,
const Container &  frame_ids 

◆ GeometrySet() [9/11]

GeometrySet ( const Container &  geometry_ids,
std::initializer_list< FrameId frame_ids 

◆ GeometrySet() [10/11]

GeometrySet ( std::initializer_list< GeometryId geometry_ids,
std::initializer_list< FrameId frame_ids 

◆ GeometrySet() [11/11]

GeometrySet ( const ContainerG &  geometry_ids,
const ContainerF &  frame_ids 

Member Function Documentation

◆ operator=() [1/2]

GeometrySet& operator= ( const GeometrySet )

◆ operator=() [2/2]

GeometrySet& operator= ( GeometrySet &&  )

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