DART  6.7.3
dart::dynamics::Linkage::Criteria Struct Reference

The Criteria class is used to specify how a Linkage should be constructed. More...

#include <Linkage.hpp>

Classes

struct  Target
 This structure defines targets for the expansion criteria and the desired behavior for those targets. More...
 
struct  Terminal
 Any expansion performed by the criteria will be halted if mTerminal is reached. More...
 

Public Types

enum  ExpansionPolicy { INCLUDE = 0 , EXCLUDE , DOWNSTREAM , UPSTREAM }
 The ExpansionPolicy indicates how the collection of BodyNodes should expand from the starting BodyNode (mStart) More...
 

Public Member Functions

std::vector< BodyNode * > satisfy () const
 Return a vector of BodyNodes that satisfy the parameters of the Criteria. More...
 

Public Attributes

Target mStart
 This Target will serve as the starting point for the criteria satisfaction. More...
 
std::vector< TargetmTargets
 The Linkage will extend from mStart to each of these targets. More...
 
std::vector< TerminalmTerminals
 Any expansion (whether from an ExpansionPolicy or an attempt to reach an entry in mTargets) will be halted if it reaches any entry in mTerminal. More...
 

Protected Member Functions

void refreshTerminalMap () const
 Refresh the content of mMapOfTerminals. More...
 
void expansionPolicy (BodyNode *_start, ExpansionPolicy _policy, std::vector< BodyNode * > &_bns) const
 Satisfy the expansion policy of a target. More...
 
void expandDownstream (BodyNode *_start, std::vector< BodyNode * > &_bns, bool _includeStart) const
 Expand downstream. More...
 
void expandUpstream (BodyNode *_start, std::vector< BodyNode * > &_bns, bool _includeStart) const
 Expand upstream. More...
 
void expandToTarget (const Target &_start, const Target &_target, std::vector< BodyNode * > &_bns) const
 Construct a path from start to target. More...
 
std::vector< BodyNode * > climbToTarget (BodyNode *_start, BodyNode *_target) const
 Expand upwards from the _start BodyNode to the _target BodyNode. More...
 
std::vector< BodyNode * > climbToCommonRoot (const Target &_start, const Target &_target, bool _chain) const
 Expand upwards from both BodyNodes to a common root. More...
 
void trimBodyNodes (std::vector< BodyNode * > &_bns, bool _chain, bool _movingUpstream) const
 Crawl through the list and cut it off anywhere that the criteria is violated. More...
 

Protected Attributes

std::unordered_map< BodyNode *, bool > mMapOfTerminals
 Hashed set for terminals to allow quick lookup. More...
 

Detailed Description

The Criteria class is used to specify how a Linkage should be constructed.

Member Enumeration Documentation

◆ ExpansionPolicy

The ExpansionPolicy indicates how the collection of BodyNodes should expand from the starting BodyNode (mStart)

Enumerator
INCLUDE 

Do not expand from the target. Include everything up to the target and then stop.

EXCLUDE 

Do not expand from the target. Include everything up to the target, but NOT the target, and then stop.

DOWNSTREAM 

Include the target, and then expand downstream, toward the leaves of the tree.

UPSTREAM 

Include the target, and then expand upstream, toward the root of the tree.

Member Function Documentation

◆ climbToCommonRoot()

std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::climbToCommonRoot ( const Target _start,
const Target _target,
bool  _chain 
) const
protected

Expand upwards from both BodyNodes to a common root.

◆ climbToTarget()

std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::climbToTarget ( BodyNode _start,
BodyNode _target 
) const
protected

Expand upwards from the _start BodyNode to the _target BodyNode.

◆ expandDownstream()

void dart::dynamics::Linkage::Criteria::expandDownstream ( BodyNode _start,
std::vector< BodyNode * > &  _bns,
bool  _includeStart 
) const
protected

Expand downstream.

◆ expandToTarget()

void dart::dynamics::Linkage::Criteria::expandToTarget ( const Target _start,
const Target _target,
std::vector< BodyNode * > &  _bns 
) const
protected

Construct a path from start to target.

◆ expandUpstream()

void dart::dynamics::Linkage::Criteria::expandUpstream ( BodyNode _start,
std::vector< BodyNode * > &  _bns,
bool  _includeStart 
) const
protected

Expand upstream.

◆ expansionPolicy()

void dart::dynamics::Linkage::Criteria::expansionPolicy ( BodyNode _start,
ExpansionPolicy  _policy,
std::vector< BodyNode * > &  _bns 
) const
protected

Satisfy the expansion policy of a target.

◆ refreshTerminalMap()

void dart::dynamics::Linkage::Criteria::refreshTerminalMap ( ) const
protected

Refresh the content of mMapOfTerminals.

◆ satisfy()

std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::satisfy ( ) const

Return a vector of BodyNodes that satisfy the parameters of the Criteria.

◆ trimBodyNodes()

void dart::dynamics::Linkage::Criteria::trimBodyNodes ( std::vector< BodyNode * > &  _bns,
bool  _chain,
bool  _movingUpstream 
) const
protected

Crawl through the list and cut it off anywhere that the criteria is violated.

Member Data Documentation

◆ mMapOfTerminals

std::unordered_map<BodyNode*, bool> dart::dynamics::Linkage::Criteria::mMapOfTerminals
mutableprotected

Hashed set for terminals to allow quick lookup.

◆ mStart

Target dart::dynamics::Linkage::Criteria::mStart

This Target will serve as the starting point for the criteria satisfaction.

◆ mTargets

std::vector<Target> dart::dynamics::Linkage::Criteria::mTargets

The Linkage will extend from mStart to each of these targets.

Each BodyNode along the way will be included in the Linkage, including the mTarget. However, if a terminal BodyNode is reached along the way, then nothing past the terminal BodyNode will be included. Therefore, If you want to expand towards a target but not include the target, you can set the BodyNode as both an mTarget and an mTerminal, and set the mInclusive flag in mTerminal to false.

◆ mTerminals

std::vector<Terminal> dart::dynamics::Linkage::Criteria::mTerminals

Any expansion (whether from an ExpansionPolicy or an attempt to reach an entry in mTargets) will be halted if it reaches any entry in mTerminal.