33 # pragma warning(push)
34 # pragma warning(disable: 6011)
40 #define AGX_USE_WIRE_CCD 1
43 # define AGX_WIRE_SHAPE agxCollide::WireShape
44 # define AGX_WIRE_SHAPE_TYPE agxCollide::Shape::WIRE_SHAPE
46 # define AGX_WIRE_SHAPE agxCollide::Capsule
47 # define AGX_WIRE_SHAPE_TYPE agxCollide::Shape::CAPSULE
53 typedef std::pair< agxWire::Node*, agxWire::Node* > NodePtrPair;
56 #if HASH_FOR_WIRE == HASH_NEW
63 #elif HASH_FOR_WIRE == HASH_OLD
75 class WireParameterController;
77 class WireContactController;
78 class WireStabilityController;
79 class WireShapeContactController;
80 class WireOldContactController;
81 class ShapeContactColliderUtils;
83 template<
typename T >
93 enum WireContactControllerType
95 OLD_CONTACT_CONTROLLER = 0,
96 SHAPE_CONTACT_CONTROLLER
106 static agx::Real getGlobalWireRadiusScaleIncrement();
118 WIRE_SPHERE_GEOMETRY_GROUP = 170000,
119 WIRE_WIRE_GEOMETRY_GROUP,
120 WIRE_DYNAMIC_CONTACTS_GROUP,
121 WIRE_SENSOR_SPHERE_CONTACTS_GROUP
127 WireGeometryController();
133 void setActiveContactControllerType(Wire* wire,
const WireContactControllerType type);
134 WireContactControllerType getActiveContactControllerType()
const;
137 const ShapeContactColliderUtils* getShapeContactControllerUtils()
const;
146 void traverse( GeometryVisitor visitor,
agx::Bool onlyEnabled )
const;
153 void preCollideUpdate();
179 virtual void removeNotification();
184 void updateGeometries();
200 void removeGeometries(
bool safeRemoveAll =
false );
223 void copyCollisionSettings( agxWire::WireGeometryController* otherLGC );
250 bool hasGroup(
const agx::Name& name )
const;
272 void updateSensorTransforms();
289 inline agx::UInt32 getWireUniqueGroupID()
const {
agxAssert( m_wireUniqueGroupID );
return m_wireUniqueGroupID; }
294 inline agx::UInt32 getSensorUniqueGroupID()
const {
agxAssert( m_sensorUniqueGroupID );
return m_sensorUniqueGroupID; }
331 agxWire::WireContactController* getActiveContactController()
const;
336 agxWire::WireOldContactController* getOldContactController()
const;
341 agxWire::WireShapeContactController* getShapeContactController()
const;
346 bool getEnable()
const;
351 bool isEnabled()
const;
357 bool getEnableFlag()
const;
363 void setEnable(
bool enable );
368 bool isActive()
const;
378 agx::Real getRadiusIncMultiplier()
const;
383 agx::Real getMaximumContactMovementOneTimestep()
const;
411 agxWire::WireImpactController* getImpactController()
const;
435 friend class WireContactController;
440 virtual ~WireGeometryController();
446 void createContactController(Wire* wire);
469 virtual void preSolve()
override;
474 virtual void postSolve()
override;
538 void pushToEnabledWireGeometries();
544 void handleFirstAndLastNodeSphereGeometry( agxWire::WireDistanceCompositeConstraint* wire )
const;
546 template <
class IdT,
class ContainerT>
547 void addGroupT( IdT
id, ContainerT& container );
549 template <
class IdT,
class ContainerT>
550 void removeGroupT( IdT
id, ContainerT& container );
554 WireImpactControllerRef m_impactController;
559 GeometryPtrHashSet m_enabledGeometries;
560 RigidBodyPtrGeometryRefTable m_lumpedSphereGeometries;
561 ContactNodePtrGeometryRefTable m_nodeSensors;
562 GeometryPtrContactNodePtrTable m_sensorNodes;
564 agx::UInt32 m_disabledCollisionsGroupIDOtherGeometries;
568 GeometryPtrGeometryObsTable m_externalDisabledGeometries;
569 UnsignedHashSet m_groupIDs;
570 NameHashSet m_groupNames;
571 GeometryPtrNodeObsPtrPairTable m_geometryNodePairTable;
573 WireParameterController* m_parameters;
578 WireContactControllerType m_contactControllerType;
582 static NodePtrPair s_nullObsPtrPair;
590 inline bool WireGeometryController::isActive()
const
592 return m_enable && m_initialized;
597 agxAssert( m_wireUniqueGroupID > 0 && (m_wire ==
nullptr || m_geometryNodePairTable.contains( geometry ) == geometry->
hasGroup( m_wireUniqueGroupID )) );
598 return m_wire !=
nullptr && geometry->
hasGroup( m_wireUniqueGroupID );
601 inline void WireGeometryController::pushToEnabledWireGeometries()
603 if ( m_disabledWireGeometries.empty() )
604 allocateWireGeometries( m_disabledWireGeometries, 32 );
605 m_enabledWireGeometries.push_back( m_disabledWireGeometries.back() );
606 m_disabledWireGeometries.pop_back();
609 inline const NodePtrPair& WireGeometryController::getNodePair(
const agxCollide::Geometry* geometry )
const
611 GeometryPtrNodeObsPtrPairTable::const_iterator i = m_geometryNodePairTable.find( geometry );
612 return i != m_geometryNodePairTable.end() ? i->second : s_nullObsPtrPair;
617 return m_simulationProxy;
622 ContactNodePtrGeometryRefTable::iterator i = m_nodeSensors.find(cln);
623 if ( i != m_nodeSensors.end() )
630 GeometryPtrContactNodePtrTable::iterator i = m_sensorNodes.find( sensor );
631 if ( i != m_sensorNodes.end() )
636 inline bool WireGeometryController::getEnable()
const
638 return m_enable && m_wire.isValid() && m_materialController.isValid() && m_parameters;
641 inline bool WireGeometryController::isEnabled()
const
646 inline void WireGeometryController::setEnable(
bool enable )
651 inline bool WireGeometryController::getEnableFlag()
const
656 inline agx::Real WireGeometryController::getRadius()
const
659 return m_materialController->getRadius();
662 inline agx::Real WireGeometryController::getRadiusIncMultiplier()
const
664 agxAssert( m_materialController && m_parameters );
665 return m_materialController->getRadius() * m_parameters->getRadiusMultiplier(m_materialController->getRadius());
668 inline agx::Real WireGeometryController::getMaximumContactMovementOneTimestep()
const
670 agxAssert( m_materialController && m_parameters );
671 return m_parameters->getMaximumContactMovementOneTimestep();
674 inline agx::Real WireGeometryController::getSensorRadius(
agx::Real wireRadius )
const
676 agxAssert( m_materialController && m_parameters );
677 return m_parameters->getSensorRadius(wireRadius );
680 inline WireImpactController* WireGeometryController::getImpactController()
const
682 return m_impactController;
695 # pragma warning(pop)
#define AGXPHYSICS_EXPORT
Axis aligned bounding box implementation.
The geometry representation used by the collision detection engine.
bool hasGroup(agx::UInt32 id) const
This is performing a linear search among the collision group id for this Geometry.
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Interface class used by internal objects running in parallel.
Class for writing serialized data in binary format to a stream.
The body fixed node is attached to a body at a given offset.
Interface and placeholder of controllers/helpers for wires.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Inheritance with partial specialization due to bug with ref_ptr containers.
Inheritance with partial specialization due to bug with ref_ptr containers.
Main material class which acts as a holder of a Surface Material and a Bulk material.
Representation of a name string.
Pointer to a entity instance of type Physics.Geometry.
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr & shape()
Pointer to a entity instance of type Physics.Geometry.Shape.
AGXPHYSICS_EXPORT agx::UInt8 & type()
Pointer to a entity instance of type Physics.Geometry.WireShape.
Inheritance with partial specialization due to bug with ref_ptr containers.
The rigid body class, combining a geometric model and a frame of reference.
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()
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
AGXPHYSICS_EXPORT void addGroup(const agx::RigidBody *body, unsigned id)
For the specified body, add the collision group ID to its geometries.
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.
AGXPHYSICS_EXPORT void removeGroup(const agx::RigidBody *body, unsigned id)
For the specified body, remove the collision group ID to its geometries.
Implements a Wire model with adaptive resolution.