AGX Dynamics  2.37.2.0
agxSDK::MergedState Class Reference

Object holding merged bodies and state given a pair of rigid bodies. More...

#include <MergedState.h>

+ Inheritance diagram for agxSDK::MergedState:

Public Types

typedef agx::BitState< ActionType, agx::Int16 > Actions
 
enum  ActionType : agx::Int16 { MERGE = 1 << 0, SPLIT_FIRST = 1 << 1, SPLIT_SECOND = 1 << 2 }
 
enum  EState {
  VALID = 1 << 0, BOTH_ARE_NULL = 1 << 1, ONE_IS_NULL = 1 << 2, BOTH_ARE_VALID = 1 << 3,
  MERGED_BODIES_ARE_SAME = 1 << 4, MERGED_BODIES_ARE_DIFFERENT = 1 << 5, WIRE_BODY_INCLUDED = 1 << 6, GRANULATE_BODY_INCLUDED = 1 << 7
}
 
typedef agx::BitState< EState, agx::Int32 > State
 

Public Member Functions

 MergedState (agx::RigidBody *rb1, agx::RigidBody *rb2, const agxSDK::MergeSplitHandler *handler)
 Find merged state given two rigid bodies. More...
 
 MergedState (agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2, const agxSDK::MergeSplitHandler *handler)
 Find merged state given two geometries. More...
 
agx::Bool firstIsMerged () const
 
Actions getAllowedActions () const
 
agx::MergedBody * getMergedBody () const
 
agx::MergedBody * getMergedBody1 () const
 
agx::MergedBody * getMergedBody2 () const
 
agx::MergedBody * getOtherMergedBody () const
 
const agxSDK::MergeSplitProperties * getProperties1 () const
 
const agxSDK::MergeSplitProperties * getProperties2 () const
 
agx::RigidBody * getRigidBody1 () const
 
agx::RigidBody * getRigidBody2 () const
 
State getState () const
 
agx::Bool isValid () const
 
agx::Bool secondIsMerged () const
 
MergedState & update ()
 Update the current state of how the bodies are merged and return this. More...
 

Static Public Member Functions

static MergedState invalid ()
 Creates an invalid merged state. More...
 

Protected Member Functions

void construct (agx::RigidBody *rb1, agx::RigidBody *rb2)
 Delegating constructor. More...
 

Protected Attributes

Actions m_allowedActions
 
agx::MergedBody * m_mergedBody [2]
 
agx::MergedBody * m_preferredMergedBody
 
const agxSDK::MergeSplitProperties * m_properties [2]
 
agx::RigidBody * m_rigidBodies [2]
 
State m_state
 

Detailed Description

Object holding merged bodies and state given a pair of rigid bodies.

Definition at line 28 of file MergedState.h.

Member Typedef Documentation

◆ Actions

Definition at line 50 of file MergedState.h.

◆ State

typedef agx::BitState< EState, agx::Int32 > agxSDK::MergedState::State

Definition at line 42 of file MergedState.h.

Member Enumeration Documentation

◆ ActionType

Enumerator
MERGE 
SPLIT_FIRST 
SPLIT_SECOND 

Definition at line 44 of file MergedState.h.

◆ EState

Enumerator
VALID 

Valid state.

BOTH_ARE_NULL 

None of the bodies are merged.

ONE_IS_NULL 

One of the bodies are merged.

BOTH_ARE_VALID 

Both of the bodies are merged.

MERGED_BODIES_ARE_SAME 

The bodies are merged together.

MERGED_BODIES_ARE_DIFFERENT 

Both bodies are merged but has different parents (i.e., not merged with each other).

WIRE_BODY_INCLUDED 
GRANULATE_BODY_INCLUDED 

Definition at line 31 of file MergedState.h.

Constructor & Destructor Documentation

◆ MergedState() [1/2]

agxSDK::MergedState::MergedState ( agx::RigidBody *  rb1,
agx::RigidBody *  rb2,
const agxSDK::MergeSplitHandler *  handler 
)

Find merged state given two rigid bodies.

Parameters
rb1- first rigid body
rb2- second rigid body

◆ MergedState() [2/2]

agxSDK::MergedState::MergedState ( agxCollide::Geometry *  geometry1,
agxCollide::Geometry *  geometry2,
const agxSDK::MergeSplitHandler *  handler 
)

Find merged state given two geometries.

Parameters
geometry1- first geometry
geometry2- second geometry

Member Function Documentation

◆ construct()

void agxSDK::MergedState::construct ( agx::RigidBody *  rb1,
agx::RigidBody *  rb2 
)
protected

Delegating constructor.

◆ firstIsMerged()

agx::Bool agxSDK::MergedState::firstIsMerged ( ) const
Returns
true if first object during construct is merged

◆ getAllowedActions()

MergedState::Actions agxSDK::MergedState::getAllowedActions ( ) const
Returns
the allowed actions a merge split algorithm may perform

Definition at line 191 of file MergedState.h.

◆ getMergedBody()

agx::MergedBody* agxSDK::MergedState::getMergedBody ( ) const
Returns
the preferred merged body (larges if two, non-null if one)

◆ getMergedBody1()

agx::MergedBody* agxSDK::MergedState::getMergedBody1 ( ) const
Returns
the merged body associated to the first object during construct

◆ getMergedBody2()

agx::MergedBody* agxSDK::MergedState::getMergedBody2 ( ) const
Returns
the merged body associated to the second object during construct

◆ getOtherMergedBody()

agx::MergedBody* agxSDK::MergedState::getOtherMergedBody ( ) const
Returns
the other (not preferred) if both bodies are merged, otherwise null

◆ getProperties1()

const agxSDK::MergeSplitProperties* agxSDK::MergedState::getProperties1 ( ) const
Returns
properties used for first rigid body (the properties could belong to a geometry)

◆ getProperties2()

const agxSDK::MergeSplitProperties* agxSDK::MergedState::getProperties2 ( ) const
Returns
properties used for second rigid body (the properties could belong to a geometry)

◆ getRigidBody1()

agx::RigidBody* agxSDK::MergedState::getRigidBody1 ( ) const
Returns
first rigid body (coupled to getMergedBody1)

◆ getRigidBody2()

agx::RigidBody* agxSDK::MergedState::getRigidBody2 ( ) const
Returns
second rigid body (coupled to getMergedBody2)

◆ getState()

MergedState::State agxSDK::MergedState::getState ( ) const
Returns
true if one or more masks matches current state

Definition at line 186 of file MergedState.h.

◆ invalid()

static MergedState agxSDK::MergedState::invalid ( )
static

Creates an invalid merged state.

◆ isValid()

agx::Bool agxSDK::MergedState::isValid ( ) const
Returns
true if the state is valid, i.e., a state different from NONE

Definition at line 196 of file MergedState.h.

◆ secondIsMerged()

agx::Bool agxSDK::MergedState::secondIsMerged ( ) const
Returns
true if second object during construct is merged

◆ update()

MergedState& agxSDK::MergedState::update ( )

Update the current state of how the bodies are merged and return this.

Member Data Documentation

◆ m_allowedActions

Actions agxSDK::MergedState::m_allowedActions
protected

Definition at line 155 of file MergedState.h.

◆ m_mergedBody

agx::MergedBody* agxSDK::MergedState::m_mergedBody[2]
protected

Definition at line 150 of file MergedState.h.

◆ m_preferredMergedBody

agx::MergedBody* agxSDK::MergedState::m_preferredMergedBody
protected

Definition at line 151 of file MergedState.h.

◆ m_properties

const agxSDK::MergeSplitProperties* agxSDK::MergedState::m_properties[2]
protected

Definition at line 153 of file MergedState.h.

◆ m_rigidBodies

agx::RigidBody* agxSDK::MergedState::m_rigidBodies[2]
protected

Definition at line 152 of file MergedState.h.

◆ m_state

State agxSDK::MergedState::m_state
protected

Definition at line 154 of file MergedState.h.


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