36 typedef std::pair< Real, Real >
RealPair;
39 class ConstraintImplementation;
47 namespace agxCollide {
315 template<
typename T >
324 template<
typename T >
335 template<
typename ContainerT,
typename Pred >
338 int size = (int)container.size();
342 for (
int i = 1; i < size; ++i ) {
343 typename ContainerT::value_type tmp = container[ i ];
345 for ( j = i; j > 0; --j )
346 if ( pred( tmp, container[ j - 1 ] ) )
347 container[ j ] = container[ j - 1 ];
349 container[ j ] = tmp;
357 template<
typename ContainerT >
367 template<
typename ContainerT >
370 if ( container.size() < 2 )
373 for (
size_t i = 0; i < container.size() - 1; ++i )
374 if ( container[ i + 1 ] < container[ i ] )
422 class ConstraintHolderImplementation* m_implementation;
444 template<
typename T >
455 #define callback_implementation( callback_name ) \
456 virtual void callback_name( const agx::TimeStamp& t ) \
458 if ( !m_obj.isValid() ) { \
459 getSimulation()->remove( this ); \
462 m_obj->callback_name( t ); \
468 #undef callback_implementation
492 template< typename T >
497 : agxSDK::ContactEventListener( mask ), m_obj( obj ) {}
502 #define callback_implementation( callback_name, ArgT ) \
503 virtual agxSDK::ContactEventListener::KeepContactPolicy callback_name( const agx::TimeStamp& t, ArgT obj ) \
505 if ( !m_obj.isValid() ) { \
506 getSimulation()->remove( this ); \
507 return agxSDK::ContactEventListener::KEEP_CONTACT; \
509 return m_obj->callback_name( t, obj ); \
514 #undef callback_implementation
518 if ( !m_obj.isValid() ) {
523 m_obj->separation( t, gp );
540 static void setInstance(
SceneRoot* baseInstance );
542 SINGLETON_CLASSNAME_METHOD();
std::pair< Real, Real > RealPair
AGXTERRAIN_EXPORT void clear()
AGXPHYSICS_EXPORT bool setEnableGeometries(agx::RigidBody *body, bool enable)
Enable or disable all geometries in a RigidBody.
Utility class to hold custom implementations of constraints.
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Derive from this class to implement a listener for simulation Step events.
Utility class to get step event callbacks to any class having the methods implemented.
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
static SceneRoot * s_baseInstance
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
virtual bool createVisual(agx::RigidBody *, float=0.30f)
StepEventListener(int mask=DEFAULT)
Default constructor, sets the default activation mask to all (POST_STEP and PRE_STEP) events...
Less than operator to e.g., sort functions.
GeneralStepListener(T *obj, int mask=agxSDK::StepEventListener::DEFAULT)
AGXPHYSICS_EXPORT agx::AffineMatrix4x4 calculateCylinderTransform(const agx::Vec3 &startPoint, const agx::Vec3 &endPoint)
Calculates transform that can be used for cylinders/capsules like geometries.
#define AGXPHYSICS_EXPORT
The base class for a constraint.
#define callback_implementation(callback_name)
agx::Bool isSorted(const ContainerT &container)
std::valarray friendly is sorted function.
agx::ref_ptr< ConstraintHolder > ConstraintHolderRef
void insertionSort(ContainerT &container, Pred pred)
Insertion sort, supports std::valarray.
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
AGXPHYSICS_EXPORT bool extractRigidBodies(agx::RigidBodyPtrVector &bodies, agxSDK::Assembly *assembly)
Utility function to extract all Rigid Bodies from an assembly (and its sub-assemblies).
virtual void render(class agxRender::RenderManager *, float) const override
Inherited method of how to render this constraint into DebugRenderer.
Jump request options for wire nodes which parent isn't the given assembly/collection.
The geometry representation used by the collision detection engine.
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.
virtual ~GeneralStepListener()
AGXPHYSICS_EXPORT void addGroup(const agx::RigidBody *body, unsigned id)
For the specified body, add the collision group ID to its geometries.
Eye nodes which parent isn't included in the assembly will become lumped nodes instead.
Vector containing 'raw' data.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
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.
AGXPHYSICS_EXPORT size_t getMeshData(const agxCollide::Mesh *mesh, agx::Vec3Vector &vertices, agx::UInt32Vector &indices)
Extract vertices and indices from mesh.
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...
The default activation mask.
virtual bool createVisual(agxCollide::Geometry *, float=0.30f)
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...
AGXPHYSICS_EXPORT bool extractGeometries(agxCollide::GeometryPtrVector &geometries, agxSDK::Assembly *assembly)
Utility function to extract all geometries from an assembly (and its sub-assemblies), including geometries found in RigidBodies which are a part of the assembly (and sub-assemblies).
The rigid body class, combining a geometric model and a frame of reference.
Main material class which acts as a holder of a Surface Material and a Bulk material.
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.
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
agx::VectorPOD< RigidBodyPtr > RigidBodyPtrVector
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...
The complete physical system with bodies, interactions, data layout, time stepper, and solver.
Contact nodes which parent isn't included in the assembly will become lumped nodes instead...
Simulation * getSimulation()
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
AGXPHYSICS_EXPORT void removeGroup(const agx::RigidBody *body, unsigned id)
For the specified body, remove the collision group ID to its geometries.
AGXPHYSICS_EXPORT bool setBodyMaterial(agx::RigidBody *body, agx::Material *material)
Utility function to loop through a body and set the material for associated geometry.
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.
agx::observer_ptr< T > m_obj
agx::Bool operator()(const T &o1, const T &o2)
agx::Bool operator()(const T &o1, const T &o2)
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
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.
Larger than operator to e.g., sort functions.
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 preCollide(const agx::TimeStamp &time)
Called before collision detection is performed in the simulation Implement this method in the derived...
virtual int getNumDOF() const override
#define DOXYGEN_END_INTERNAL_BLOCK()
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.
#define DOXYGEN_START_INTERNAL_BLOCK()
An assembly is a collection of basic simulation objects, such as rigid bodies, constraints, geometries.
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
AGXPHYSICS_EXPORT bool extractConstraints(agx::ConstraintPtrVector &vec, agx::DynamicsSystem *system)
Utility function to extract all constraints from the system.