33 # pragma warning(push)
34 # pragma warning(disable: 6011) // Disable warningC6011: dereferencing nullptr pointer
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)