39 class LinkExecuteFilter;
40 class GeometryPropertyBoolFilter;
41 class RigidBodyPropertyBoolFilter;
58 void setTensionThreshold(
agx::Real tensionThreshold );
75 LinkObjectStabilizingAlgorithm();
80 virtual ~LinkObjectStabilizingAlgorithm();
86 virtual
void onLinkEnable( agx::
Bool enable, agxWire::
Link* link, agxSDK::SimulationProxy* simulationProxy ) override;
91 virtual
void pre( agxWire::
Link* link, agxSDK::SimulationProxy* simulationProxy ) override;
96 virtual
void post( agxWire::
Link* link, agxSDK::SimulationProxy* simulationProxy ) override;
103 ConstraintContainer m_constraints;
115 class
AGXPHYSICS_EXPORT LinkObjectStabilizingAlgorithm::LinkExecuteFilter : public agxSDK::ExecuteFilter, public agxStream::Serializable
136 virtual
void store( agxStream::OutputArchive&
out ) const override;
141 virtual
void restore( agxStream::InputArchive&
in ) override;
154 virtual
bool matchOther( const agxCollide::Geometry* otherGeometry ) const = 0;
156 using agxSDK::ExecuteFilter::match;
161 virtual
bool match( const agxCollide::Geometry* geometry1, const agxCollide::Geometry* geometry2 )
const override
167 if ( m_link ==
nullptr )
170 agx::Bool firstIsLink = m_link !=
nullptr && geometry1->getRigidBody() == m_link->getRigidBody();
171 agx::Bool secondIsLink = m_link !=
nullptr && geometry2->getRigidBody() == m_link->getRigidBody();
172 return firstIsLink ? matchOther( geometry2 ) : secondIsLink ? matchOther( geometry1 ) :
false;
198 : LinkExecuteFilter( link ), m_propertyName( propertyName ) {}
210 GeometryPropertyBoolFilter();
215 virtual ~GeometryPropertyBoolFilter();
221 virtual
bool matchOther( const agxCollide::Geometry* otherGeometry )
const override
223 return matchT( otherGeometry );
230 template<
typename T >
234 return obj !=
nullptr &&
235 obj->hasPropertyContainer() &&
236 obj->getPropertyContainer()->getPropertyBool( m_propertyName, propertyValue ) &&
263 : GeometryPropertyBoolFilter( propertyName, link ) {}
275 RigidBodyPropertyBoolFilter();
280 virtual ~RigidBodyPropertyBoolFilter();
286 virtual
bool matchOther( const agxCollide::Geometry* otherGeometry )
const override
288 return matchT( otherGeometry->getRigidBody() );
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...
(Optional) Link algorithm that tries to stabilize the link when the link is in contact with an object...
agx::ref_ptr< GeometryPropertyBoolFilter > GeometryPropertyBoolFilterRef
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...
GeometryPropertyBoolFilter(const agx::String &propertyName, const agxWire::Link *link)
Construct matching filter given property-bool name and the link.
#define AGXPHYSICS_EXPORT
agx::Bool matchT(const T *obj) const
Match function for either agxCollide::Geometry or agx::RigidBody.
#define AGX_DECLARE_POINTER_TYPES(type)
const agxWire::Link * getLink() const
GeometryPropertyBoolFilter()
Protected default constructor, used during restore.
agx::String m_propertyName
agx::ref_ptr< ContactEventListener > ContactEventListenerRef
Smart pointer for handling referenced counted objects.
Object that defines the relation between different types of wires (agxWire::Wire).
LinkExecuteFilter(const agxWire::Link *link)
Construct given link this algorithm belongs to.
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Algorithm()
Abstract class - protected constructor.
RigidBodyPropertyBoolFilter(const agx::String &propertyName, const agxWire::Link *link)
Construct matching filter given property-bool name and the link.
ref_ptr< LockJoint > LockJointRef
agx::ref_ptr< RigidBodyPropertyBoolFilter > RigidBodyPropertyBoolFilterRef
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()