36 typedef std::pair< Real, Real >
RealPair;
39 class ConstraintImplementation;
262 bool onlyIncludeEmittedBodies);
323 DETACH_CONTACT_NODES = 1 << 0,
324 DETACH_EYE_NODES = 1 << 1
348 template<
typename T >
351 agx::Bool operator() (
const T& o1,
const T& o2 ) {
return o1 < o2; }
357 template<
typename T >
360 agx::Bool operator() (
const T& o1,
const T& o2 ) {
return o1 > o2; }
368 template<
typename ContainerT,
typename Pred >
371 int size = (int)container.size();
375 for (
int i = 1; i < size; ++i ) {
376 typename ContainerT::value_type tmp = container[ i ];
378 for ( j = i; j > 0; --j )
379 if ( pred( tmp, container[ j - 1 ] ) )
380 container[ j ] = container[ j - 1 ];
382 container[ j ] = tmp;
390 template<
typename ContainerT >
400 template<
typename ContainerT >
403 if ( container.size() < 2 )
406 for (
size_t i = 0; i < container.size() - 1; ++i )
407 if ( container[ i + 1 ] < container[ i ] )
427 template<
typename ContainerT>
455 template<
typename ContainerT>
501 class ConstraintHolderImplementation* m_implementation;
523 template<
typename T >
528 :
agxSDK::StepEventListener( mask ), m_obj( obj ) {}
534 #define callback_implementation( callback_name ) \ 535 virtual void callback_name( const agx::TimeStamp& t ) \ 537 if ( !m_obj.isValid() ) { \ 538 getSimulation()->remove( this ); \ 541 m_obj->callback_name( t ); \ 547 #undef callback_implementation 571 template<
typename T >
576 :
agxSDK::ContactEventListener( mask ), m_obj( obj ) {}
581 #define callback_implementation( callback_name, ArgT ) \ 582 virtual agxSDK::ContactEventListener::KeepContactPolicy callback_name( const agx::TimeStamp& t, ArgT obj ) \ 584 if ( !m_obj.isValid() ) { \ 585 getSimulation()->remove( this ); \ 586 return agxSDK::ContactEventListener::KEEP_CONTACT; \ 588 return m_obj->callback_name( t, obj ); \ 593 #undef callback_implementation 597 if ( !m_obj.isValid() ) {
598 getSimulation()->remove(
this );
602 m_obj->separation( t, gp );
619 static void setInstance(
SceneRoot* baseInstance );
621 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)
This namespace consists of a set of classes for handling geometric intersection tests including boole...
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)
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.
agx::ref_ptr< ConstraintHolder > ConstraintHolderRef
AGXPHYSICS_EXPORT bool isConvexMesh(const agxCollide::Mesh *mesh, agx::Real threshold=1E-5)
Algorithm for determining if a mesh is convex.
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...
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.
Vector containing 'raw' data.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
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.
ContainerT copyContainerMemory(const ContainerT &container)
Returns a copy of the passed container.
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)
The rigid body class, combining a geometric model and a frame of reference.
This namespace contains general operation and action classes which can be used to control a agxSDK::S...
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.
The complete physical system with bodies, interactions, data layout, time stepper, and solver.
void insertionSort(ContainerT &container)
Insertion sort, supports std::valarray.
#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 bool setEnableCollisions(agx::RigidBody *body, bool enable)
Enable or disable collision for all geometries in a RigidBody.
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...
agx::observer_ptr< T > m_obj
void freeContainerMemory(ContainerT &container)
Free the memory held by the given container by swapping it with a default-constructed instance...
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.
AGXPHYSICS_EXPORT bool extractGeometries(agxCollide::GeometryPtrVector &vec, agxCollide::Space *space)
Utility function to extract all geometries from the space into a vector.
Larger than operator to e.g., sort functions.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
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.
The agxUtil namespace contain classes and methods for utility functionality.
#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.