36 typedef std::pair< Real, Real >
RealPair;
39 class ConstraintImplementation;
233 template <
typename T>
236 if (body ==
nullptr) {
242 geometry->addGroup(
id);
250 template <
typename T>
253 if (body ==
nullptr) {
259 geometry->removeGroup(
id);
273 for (
auto& g: geometries)
288 for (
auto& g: geometries)
312 bool onlyIncludeEmittedBodies);
409 template<
typename T >
418 template<
typename T >
429 template<
typename ContainerT,
typename Pred >
432 int size = (int)container.size();
436 for (
int i = 1; i < size; ++i ) {
437 typename ContainerT::value_type tmp = container[ i ];
439 for ( j = i; j > 0; --j )
440 if ( pred( tmp, container[ j - 1 ] ) )
441 container[ j ] = container[ j - 1 ];
443 container[ j ] = tmp;
451 template<
typename ContainerT >
461 template<
typename ContainerT >
464 if ( container.size() < 2 )
467 for (
size_t i = 0; i < container.size() - 1; ++i )
468 if ( container[ i + 1 ] < container[ i ] )
488 template<
typename ContainerT>
516 template<
typename ContainerT>
562 class ConstraintHolderImplementation* m_implementation;
584 template<
typename T >
595#define callback_implementation( callback_name ) \
596 virtual void callback_name( const agx::TimeStamp& t ) \
598 if ( !m_obj.isValid() ) { \
599 getSimulation()->remove( this ); \
602 m_obj->callback_name( t ); \
608#undef callback_implementation
632 template< typename T >
637 :
agxSDK::ContactEventListener( mask ),
m_obj( obj ) {}
642#define callback_implementation( callback_name, ArgT ) \
643 virtual agxSDK::ContactEventListener::KeepContactPolicy callback_name( const agx::TimeStamp& t, ArgT obj ) \
645 if ( !m_obj.isValid() ) { \
646 getSimulation()->remove( this ); \
647 return agxSDK::ContactEventListener::KEEP_CONTACT; \
649 return m_obj->callback_name( t, obj ); \
654#undef callback_implementation
658 if ( !
m_obj.isValid() ) {
663 m_obj->separation( t, gp );
682 SINGLETON_CLASSNAME_METHOD();
#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
#define callback_implementation(callback_name)
Axis aligned bounding box implementation.
The geometry representation used by the collision detection engine.
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
This is a sensor class that can be attached to an geometry in the simulation.
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints,...
Simulation * getSimulation()
Simulation unique manager that handles logics around and parameters in contact materials given two ag...
bool remove(agx::ContactMaterial *material)
Remove an explicit contact material from the set of existing ContactMaterials.
Derive from this class to implement a listener for simulation step events.
virtual void preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...
virtual void pre(const agx::TimeStamp &time)
Called before a step is taken in the simulation Implement this method in the derived class to get cal...
virtual void post(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
@ DEFAULT
The default activation mask.
StepEventListener(int mask=DEFAULT)
Default constructor, sets the default activation mask to all (POST_STEP and PRE_STEP) events.
Utility class to hold custom implementations of constraints.
bool add(agx::ConstraintImplementation *constraint)
Add 'interface less' constraint implementation.
bool remove(agx::ConstraintImplementation *constraint)
Remove constraint implementation.
void clear()
Remove all constraints.
virtual int getNumDOF() const override
virtual void render(class agxRender::RenderManager *, float) const override
Inherited method of how to render this constraint into DebugRenderer.
virtual ~ConstraintHolder()
Utility class to get step event callbacks to any class having the methods implemented.
GeneralStepListener(T *obj, int mask=agxSDK::StepEventListener::DEFAULT)
virtual ~GeneralStepListener()
agx::observer_ptr< T > m_obj
static void setInstance(SceneRoot *baseInstance)
static SceneRoot * object()
virtual bool createVisual(agx::RigidBody *, float=0.30f)
void shutdown() override
Implement this method to cleanup your Singleton class.
virtual bool createVisual(agxCollide::Geometry *, float=0.30f)
static SceneRoot * s_baseInstance
The base class for a constraint.
The complete physical system with bodies, interactions, data layout, time stepper,...
Main material class which acts as a holder of a Surface Material and a Bulk material.
The rigid body class, combining a geometric model and a frame of reference.
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
const agxCollide::GeometryRefVector & getGeometries() const
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
Vector containing 'raw' data.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
This namespace consists of a set of classes for handling geometric intersection tests including boole...
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
The agxUtil namespace contain classes and methods for utility functionality.
AGXPHYSICS_EXPORT void addParentVelocity(const agx::RigidBody *parentBody, agx::RigidBody *body)
body will get the parents velocity added to its velocity as if it was rigidly attached.
AGXPHYSICS_EXPORT bool setEnableGeometries(agx::RigidBody *body, bool enable)
Enable or disable all geometries in a RigidBody.
AGXPHYSICS_EXPORT agx::Vec3 transformPointFromTo(const agx::Vec3 point, const agx::RigidBody *fromBody, const agx::RigidBody *toBody)
Point transform from rigid body fromBody to rigid body toBody.
void removeGroup(const agx::RigidBody *body, const T &id)
For the specified body, remove the collision group ID to its geometries.
AGXPHYSICS_EXPORT agxControl::EventSensor * createSinkOnGeometry(agxCollide::Geometry *geometry, bool onlyIncludeEmittedBodies)
Utillity function for creating a "sink" on a geometry that will remove rigid bodies and particles tha...
agx::Bool isSorted(const ContainerT &container)
std::valarray friendly is sorted function.
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
AGXPHYSICS_EXPORT agx::Vec3 transformVectorFromTo(const agx::Vec3 vec, const agx::RigidBody *fromBody, const agx::RigidBody *toBody)
Vector transform from rigid body fromBody to rigid body toBody.
AGXPHYSICS_EXPORT bool setEnableCollisions(agx::RigidBody *rb1, agx::RigidBody *rb2, bool enable)
Enable or disable the collision between all geometries in RigidBody rb1 and RigidBody rb2.
void insertionSort(ContainerT &container, Pred pred)
Insertion sort, supports std::valarray.
AGXPHYSICS_EXPORT bool extractConstraints(agx::ConstraintPtrVector &vec, agx::DynamicsSystem *system)
Utility function to extract all constraints from the system.
AGXPHYSICS_EXPORT agxCollide::BoundingAABB computeRigidBodyBoundingVolume(const agx::RigidBody *body)
Compute the BoundingAABB for a specified rigid body using it's geometries.
AGXPHYSICS_EXPORT agx::RealVector linspace(agx::Real start, agx::Real end, agx::UInt num)
agx::ref_ptr< ConstraintHolder > ConstraintHolderRef
AGXPHYSICS_EXPORT bool extractGeometries(agxCollide::GeometryPtrVector &geometries, agxSDK::Assembly *assembly)
Utility function to extract all geometries from an assembly (and its sub-assemblies),...
AGXPHYSICS_EXPORT size_t jumpRequest(agxSDK::Assembly *collection, agx::RigidBody *parentBody, const agx::AffineMatrix4x4 &parentBodyWorldTransform, agx::UInt32 wireOptions=agx::UInt32(0))
This method will perform a "jump request" will all bodies in the assembly, including bodies which are...
AGXPHYSICS_EXPORT bool isConvexMesh(const agxCollide::Mesh *mesh, agx::Real threshold=1E-5)
Algorithm for determining if a mesh is convex.
void addGroup(const agx::RigidBody *body, const T &id)
For the specified body, add the collision group ID to its geometries.
AGXPHYSICS_EXPORT size_t getContactMaterialVector(agxSDK::MaterialManager *mgr, agx::ContactMaterialPtrVector &contactMaterials)
Get all contact materials from the material manager and add them to the supplied vector.
ContainerT copyContainerMemory(const ContainerT &container)
Returns a copy of the passed container.
AGXPHYSICS_EXPORT bool setBodyMaterial(agx::RigidBody *body, agx::Material *material)
Utility function to loop through a body and set the material for associated geometry.
AGXPHYSICS_EXPORT size_t getMaterialVector(agxSDK::MaterialManager *mgr, agx::MaterialPtrVector &materials)
Get all materials from the material manager and add them to the supplied vector.
AGXPHYSICS_EXPORT bool extractRigidBodies(agx::RigidBodyPtrVector &bodies, agxSDK::Assembly *assembly)
Utility function to extract all Rigid Bodies from an assembly (and its sub-assemblies).
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 calculateCylinderTransform(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint)
Calculates transform that can be used for cylinders/capsules like geometries.
AGXPHYSICS_EXPORT size_t getMeshData(const agxCollide::Mesh *mesh, agx::Vec3Vector &vertices, agx::UInt32Vector &indices)
Extract vertices and indices from mesh.
void freeContainerMemory(ContainerT &container)
Free the memory held by the given container by swapping it with a default-constructed instance.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::pair< Real, Real > RealPair
Jump request options for wire nodes which parent isn't the given assembly/collection.
@ DETACH_CONTACT_NODES
Contact nodes which parent isn't included in the assembly will become lumped nodes instead.
@ DETACH_EYE_NODES
Eye nodes which parent isn't included in the assembly will become lumped nodes instead.
Larger than operator to e.g., sort functions.
agx::Bool operator()(const T &o1, const T &o2)
Less than operator to e.g., sort functions.
agx::Bool operator()(const T &o1, const T &o2)