17 #ifndef AGX_MERGESPLIT_H
18 #define AGX_MERGESPLIT_H
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Book keeping of a body which can be merged with other bodies.
Class for intercepting merge/split events.
virtual bool split(agx::RigidBody *parent, agx::RigidBody *child, agxCollide::GeometryContact *contact)=0
If this method returns true, the split operation will proceed, otherwise it will be canceled.
virtual bool merge(agx::RigidBody *parent, agx::RigidBody *child)=0
If this method returns true, the merge operation will proceed, otherwise it will be canceled.
Class which will go through contacting/separating bodies and determine if the bodies can be merged (g...
bool sleep(agx::RigidBody *body1, agx::RigidBody *body2)
bool wake(agx::RigidBody *body1, agx::RigidBody *body2)
GeometryBodyHashVector m_geometryBodyHash
bool getSplitInPost() const
bool split(const agxCollide::GeometryContactPtrVector &contacts)
void split()
Explicit call to split, will go and ask space for contacts and separations and see if something can b...
const MergeSplitThreshold * getThreshold() const
void merge()
Explicit call to merge, will go and ask space for contacts and separations and see if something can b...
bool split(agx::RigidBody *bodyToBeSplit, bool forceSplit=false, bool splitImmediately=true)
Take the specified body bodyToBeSplit and if it is merged, then split it from any parents,...
MergeSplitBodyStorageRefVector m_bodyStoragePool
void setSplitInPost(bool flag)
Specifies whether the split should occur in the pre solver step, or in the post step.
void transferGeometries(agx::RigidBody *child, agxCollide::GeometryRefVector geometries, agx::RigidBody *parent)
void pre(const agx::TimeStamp &t)
void registerGeometriesBodies(agxSDK::Simulation *sim)
MergeSplitBodyStorage * getBodyStorage()
agx::Vector< MergeSplitBodyStorage * > MergeSplitBodyStoragePtrVector
agx::observer_ptr< agxCollide::Space > m_space
MergeSplitThreshold * getThreshold()
void clear()
Split all merged bodies, clear all data structures.
void updateContacts(const agxCollide::GeometryContactPtrVector &contacts, bool removeContacts=false) const
bool merge(agx::RigidBody *child, agx::RigidBody *parent)
Explicitly merge two bodies.
agx::Vector< agx::ref_ptr< MergeSplitBodyStorage > > MergeSplitBodyStorageRefVector
static void calculateSeparatingVelocityAcceleration(agx::RigidBody *body1, agx::RigidBody *body2, agx::Real &dVel, agx::Real &dOmega, agx::Real &dAcc, agx::Real &dAngularAcc)
Calculate the relative velocity/acceleration of two rigidbodies center of mass velocities.
agx::ref_ptr< Listener > ListenerRef
bool split(agxCollide::Geometry *geom1, agxCollide::Geometry *geom2, agxCollide::GeometryContact *contact=nullptr)
void setSpace(agxCollide::Space *space)
Tell MergeSplit which space to use for accessing contacts.
void prepareForMerge(agx::RigidBody *body)
void returnBodyStorage(MergeSplitBodyStorage *bodyStorage)
bool _split(agx::RigidBody *bodyToBeSplit, agxCollide::GeometryContact *contact, bool forceSplit=false, bool splitImmediately=true)
Take the specified body bodyToBeSplit and if it is merged, then split it from any parents,...
MergeSplitBodyStoragePtrVector m_freeBodyStorage
void post(const agx::TimeStamp &t)
const Listener * getListener() const
agx::HashVector< agxCollide::Geometry *, agx::ref_ptr< MergeSplitBodyStorage > > GeometryBodyHashVector
void removeNotification()
MergeSplit(agxCollide::Space *space=nullptr)
Default constructor.
bool merge(const agxCollide::GeometryContactPtrVector &contacts)
bool performMerge(agx::RigidBody *child, agx::RigidBody *parent)
agx::ref_ptr< SleepThreshold > m_threshold
agx::RigidBodyObserverVector m_bodiesToBeSplit
bool split(const agxCollide::SeparationPairVector &separations)
void setListener(Listener *listener)
Specify a point to a listener that will be called upon merge/split events.
void setEnable(bool flag)
Enable/disable MergeSplit.
bool split(agxCollide::Geometry *geometry, bool shouldUpdateContacts=true, bool forceSplit=false, bool splitImmediately=true)
Take a specified geometry geometry and locate its ORIGINAL body (which was the original body that thi...
bool shouldMerge(agx::RigidBody *body1, agx::RigidBody *body2, agxCollide::GeometryContact *contact) const
bool removeFromBodyStorage(agx::RigidBody *body)
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< MergeSplit > MergeSplitRef