17 #ifndef AGXMODEL_FRACTURESIMULATOR_H
18 #define AGXMODEL_FRACTURESIMULATOR_H
135 void setGlobalFractureEnable(
bool enable);
138 bool getGlobalBreakageEnable()
const;
141 void setAddFractureFragmentsToGenerator(
bool enable);
303 m_newBodyCallback(fractureListener, fractureGeomety, body);
374 GeometryHashContainer m_breakableGeometries;
375 GeometryHashContainer m_breakerGeometries;
376 ExecuteFilterHashContainer m_breakerCollisionFilters;
377 bool m_enableGlobalFracture;
378 bool m_addFractureFragmentsToGenerator;
384 FractureContactGathererRef m_contactGatherer;
385 NewBodyCallbackWrapperRef m_newBodyCallbackWrapper;
507 m_enableGlobalFracture = enable;
512 return m_enableGlobalFracture;
517 m_addFractureFragmentsToGenerator = enable;
522 m_fractureAlgorithm = algorithm;
527 return m_breakableGeometries.find(
const_cast<agxCollide::Geometry*
>(geometry)) != m_breakableGeometries.end();
532 return m_breakageContacts;
538 m_newBodyCallbackWrapper = newBodyCallback;
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGX_DECLARE_VECTOR_TYPES(type)
The geometry representation used by the collision detection engine.
agx::Real m_stressLevelToBreak
FractureAlgorithmBreakOnStress(agx::Real stressLevelToBreak)
FractureAlgorithmBreakOnStress()
virtual bool shouldFracture(agxModel::FractureGenerator *fractureListener, agxCollide::GeometryContact *gc, agxCollide::Geometry *geometryToFracture) override
Function that is overridden by child classes to evaluate if a contact fulfills the condition for crea...
Class for encapsulating fracture conditions for generating fractures in a breakable object.
virtual ~FractureAlgorithm()
virtual bool shouldFracture(agxModel::FractureGenerator *fractureListener, agxCollide::GeometryContact *gc, agxCollide::Geometry *geometryToFracture)
Function that is overridden by child classes to evaluate if a contact fulfills the condition for crea...
Class for encapsulating a lambda that that will execute on new fragments created in the fracture gene...
NewBodyCallbackWrapperLambda(const NewBodyCallback &newBodyCallback)
virtual ~NewBodyCallbackWrapperLambda()
virtual void onNewBody(agxModel::FractureGenerator *fractureListener, agxCollide::Geometry *fractureGeomety, agx::RigidBody *body) override final
Function that will be called in the fracture generator for each new rigid body fragment that are crea...
Base Abstract class for encapsulating a callback that is executed on new fragments that are created i...
virtual ~NewBodyCallbackWrapper()
virtual void onNewBody(agxModel::FractureGenerator *fractureListener, agxCollide::Geometry *fractureGeomety, agx::RigidBody *body)=0
Function that will be called in the fracture generator for each new rigid body fragment that are crea...
bool removeBreaker(agx::RigidBody *body)
Removes all the rigid body's geometries as a 'breakers' from the fracture logic.
bool isBreaker(agxCollide::Geometry *breaker) const
bool removeBreaker(agxCollide::Geometry *geom)
Removes a geometry as a 'breaker' in the fracture logic.
std::function< void(FractureGenerator *, agxCollide::Geometry *, agx::RigidBody *)> NewBodyCallback
ConvexVector fractureShape(const agxCollide::Shape *shape)
Utility function to fracture an arbitrary shape with existing FractureGenerator settings.
agx::HashVector< agxCollide::GeometryRef > GeometryHashContainer
bool addBreaker(agx::RigidBody *body)
Adds the specified rigid body's geometries as a 'breakers' in the fracture logic.
bool getGlobalBreakageEnable() const
Get true/false if ALL contacts in the simulation should trigger possible fractures of breakable geome...
void handleContacts(const agxCollide::GeometryContactPtrVector &contacts)
agx::Real getResolution() const
Get resolution for plane tessellation in Voronoi diagram of basic primitives such as Spheres,...
agx::HashVector< agxSDK::ExecuteFilterRef > ExecuteFilterHashContainer
void removeNotification() override
Called when this listener is removed from the simulation.
void setAddFractureFragmentsToGenerator(bool enable)
Set true/false if fragments generated by fracture should be included as breakable objects....
void setResolution(agx::Real resolution)
Set resolution for plane tessellation in Voronoi diagram of basic primitives such as Spheres,...
void setFractureAlgorithm(FractureAlgorithm *algorithm)
Sets the FractureAlgorithm used in the fracture logic.
bool isBreakable(const agxCollide::Geometry *geometry) const
Returns true/false if the specified geometry is registered as a breakable object in the fracture logi...
bool addBreakable(agx::RigidBody *body)
Adds all the geometries inside the rigid body as breakable objects.
void addNotification() override
Called when this listener is added to the simulation.
bool removeBreakable(agxCollide::Geometry *geometry)
Removes a geometry as a breakable object from the fracture logic.
bool addBreaker(agxCollide::Geometry *geom)
Adds a geometry as a 'breaker' in the fracture logic.
static bool extractFractureGenerators(agxModel::FractureGeneratorPtrVector &fractureGenerators, agxSDK::Simulation *simulation)
Utility function to extract all FractureGeneratos from an simulation (and its sub-simulation).
bool shapeSupportsFracture(const agxCollide::Shape *shape) const
bool addBreakerFilter(agxSDK::ExecuteFilter *filter)
Adds a contact filter that governs what types of contacts that should trigger a fracture.
void setGlobalFractureEnable(bool enable)
Set true/false if ALL contacts in the simulation should trigger possible fractures of breakable geome...
virtual void pre(const agx::TimeStamp &time) override
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
void setNewBodyCallbackWrapper(NewBodyCallbackWrapper *newBodyCallback)
Adds a class instance that holds a callback that will be called for every rigid body fragment created...
void setNewBodyCallback(NewBodyCallback callback)
Adds a callback that will be called for every rigid body fragment created in a fracture event.
virtual ~FractureGenerator()
bool addBreakable(agxCollide::Geometry *geometry)
Adds a geometry as a breakable object to the fracture listener.
bool removeBreakable(agx::RigidBody *body)
Removes all the geometries inside the rigid body as breakable objects in the fracture logic.
agx::Vector< agxCollide::Convex * > ConvexVector
ConvexVector fractureShape(const agxCollide::Shape *shape, size_t numPoints)
virtual void post(const agx::TimeStamp &time) override
Called after a step is taken in the simulation Implement this method in the derived class to get call...
void setFractureMinimumSize(agx::Real minsize)
Sets the minimum size that allows fracture of an object, derived from it's bounding box.
void updateContactListener()
virtual void preCollide(const agx::TimeStamp &time) override
Called before collision detection is performed in the simulation Implement this method in the derived...
FractureGenerator()
Default constructor.
bool setNumFractureFragmentsInterval(agx::UInt min, agx::UInt max)
Sets the interval of possible fragments that can be created when a geometry is fractured.
Abstract base class that implements a filter that selects which events should trigger a Listener.
virtual bool match(const agxCollide::GeometryContact &gc) const
Called when narrow phase tests have determined overlap (when we have detailed intersection between th...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Derive from this class to implement a listener for simulation step events.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
A range object has a min and max value of a given type and provides services to tell whether a value ...
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
Vector containing 'raw' data.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)