22#define LINK_V2_SERIALIZATION_VERSION agx::UInt16( 37 )
26 class SimulationProxy;
57 INVALID_CONNECTION = 0xFF
85 agx::Bool findClosestIfLinkConnections =
false );
203 template<
typename T >
244 template<
typename Pred>
250 template<
typename Pred>
289 void initialize(
agxSDK::SimulationProxy* simulationProxy );
296 void setEnable(
agx::Bool enable,
agxSDK::SimulationProxy* simulationProxy );
314 INITIALIZED = 1 << 0,
315 ENABLE_TOGGLED = 1 << 1
362 friend class LinkController;
465 template<
typename T >
471 template<
typename T >
477 template<
typename T >
485 virtual
void store(
agxStream::OutputArchive& out ) const override;
490 virtual
void restore(
agxStream::InputArchive& in ) override;
503 enum
State { IDLE = 0, UPDATING_CHILDREN = (1<<0) };
509 ChildrenContainer m_children;
510 ChildrenContainer m_removedChildren;
511 Link::Algorithm* m_parent;
517 inline
void Link::Algorithm::onLinkEnable(
agx::Bool ,
agxWire::Link* ,
agxSDK::SimulationProxy* ) {}
528 T* algorithm =
nullptr;
537 template<typename Pred>
541 ret.
reserve( m_connections.size() );
542 for (
agx::UInt i = 0, numConnections = m_connections.size(); i < numConnections; ++i )
543 if ( pred( m_connections[ i ] ) )
548 template<
typename Pred>
551 for (
agx::UInt i = 0, numConnections = m_connections.
size(); i < numConnections; ++i )
552 if ( pred( m_connections[ i ] ) )
553 return m_connections[ i ];
558 T* Link::Algorithm::find()
const
561 for (
agx::UInt i = 0; algorithm ==
nullptr && i < m_children.size(); ++i )
562 algorithm = m_children[ i ]->find<T>();
568 const T* Link::Algorithm::as()
const
570 return dynamic_cast<const T*
>( this );
574 T* Link::Algorithm::as()
576 return dynamic_cast<T*
>( this );
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
Interface class used by internal objects running in parallel.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Connecting nodes contains two nodes, one at center of mass and the other at the user defined position...
Object holding parameters, such as bend and twist stiffness, related to wire to link connections.
Interface class for nodes connected to links.
Object that defines the relation between different types of wires (agxWire::Wire).
agx::Bool getEnable() const
agxWire::ILinkNode * findConnectingNode(Pred pred) const
const agxWire::Link::ConnectionsContainer & getConnections() const
ILinkNode::ConnectionProperties m_defaultWireConnectionProperties
agx::Bool remove(agxWire::Link::Algorithm *algorithm)
Remove link algorithm.
virtual void post(agxWire::Link *link, agxSDK::SimulationProxy *simulationProxy)
Simulation post callback.
agx::Bool hasConnection(const agxWire::Wire *wire) const
void preChildrenUpdate()
Internal method.
virtual void preCollide(agxWire::Link *link, agxSDK::SimulationProxy *simulationProxy)
Simulation pre-collide callback.
void postChildrenUpdate()
Internal method.
void debugRenderConnections() const
Shows connection points in debug rendering view.
void addConnection(agxWire::Link::ConnectionsContainer &connections, agxWire::ILinkNode *node)
Add connection, register to LinkController.
agx::Bool disconnect(agxWire::Link *otherLink)
Disconnect, or detach, this link from otherLink.
agx::UInt getNumConnections() const
agx::Bool disconnect(agxWire::Wire *wire)
Disconnect, or detach, this link from wire.
void collectGarbage()
Checks connections and removes them where the wires have been deleted.
agx::Bool add(agxWire::Link::Algorithm *algorithm)
Add a link algorithm.
agxWire::Link::Algorithm * getChild(agx::UInt i) const
agx::RigidBody * getRigidBody() const
void addState(agxWire::Link::State state)
Add state.
agx::Bool removeChild(agxWire::Link::Algorithm *algorithm)
Remove child algorithm.
void removeState(agxWire::Link::State state)
Remove state.
WinchState findWinchState() const
Finds a state how this link is interacting with any winch.
Link()
Default constructor during restore.
agxWire::Link::Algorithm * getParent() const
agx::Bool attach(agxWire::Wire *wire, const agx::Vec3 &relativeTranslate, agxWire::Link::ConnectionType type)
Connects/maps and attaches wire to this link.
static agxWire::Link * getLink(const agxWire::ConnectingNode *connectingNode)
agx::UInt getNumChildren() const
agx::Bool hasState(agxWire::Link::State state) const
agx::Constraint * getConnectingConstraint(const agxWire::Link *link) const
Link(agx::RigidBody *rb)
Default constructor.
static agxWire::Link * getConnectingLink(const agxWire::ConnectingNode *connectingNode)
static agxWire::Wire * getWire(const agxWire::ConnectingNode *connectingNode, agx::Bool findClosestIfLinkConnections=false)
ConnectionType
Connection type of the wires connected to this link, i.e., if this link should be attached to begin o...
@ LINK
Link attached to another link.
void transform()
Transforms all the connecting nodes when for example the rigid body has been moved.
virtual void update(agxWire::WireParallelCallbacksHandler::CallbackTypes type, agxSDK::SimulationProxy *simulationProxy)
Update call.
virtual agx::Bool executeUpdate(const agxSDK::SimulationProxy *simulationProxy)
Garbage collects and checks if this link is ready for update calls.
AlgorithmContainer m_newlyAddedAlgorithms
Algorithm()
Abstract class - protected constructor.
agx::Bool connect(agxWire::Link *link, agx::Constraint *constraint)
Connect this link to another link with a constraint.
agx::Vector< agxWire::LinkRef > LinkConnectionsContainer
const agxWire::ILinkNode::ConnectionProperties * getDefaultWireConnectionProperties() const
AlgorithmContainer m_algorithms
virtual ~Link()
Reference counted object - protected destructor.
WinchState
State when a link is interacting with a winch.
agxWire::ILinkNode::ConnectionProperties * getDefaultWireConnectionProperties()
Access default wire connection properties for each new wire that's connected to this link.
void eraseConnection(agxWire::Link::ConnectionsContainer &connections, agxWire::ILinkNode *node)
Erase connection, register to LinkController.
agx::Vector< agxWire::Link::AlgorithmRef > AlgorithmContainer
agx::Bool addChild(agxWire::Link::Algorithm *algorithm)
Add unique child algorithm.
static agx::Bool connect(agxWire::Wire *wire1, const agx::Vec3 &relativeTranslate1, agxWire::Link *link, agxWire::Wire *wire2, const agx::Vec3 &relativeTranslate2)
Utility function to connect two wires with a link.
ILinkNode::ConnectionProperties m_defaultLinkConnectionProperties
agxWire::Link::ConnectionsContainer getConnectingNodes(Pred pred) const
agxWire::Winch * findPulledInWinch() const
Finds the winch this link is completely pulled into, meaning this link is inactive with WinchState::P...
virtual void pre(agxWire::Link *link, agxSDK::SimulationProxy *simulationProxy)
Simulation pre callback.
virtual void onLinkEnable(agx::Bool enable, agxWire::Link *link, agxSDK::SimulationProxy *simulationProxy)
Called when link enable state is changed.
static agxWire::Link::ConnectionType getConnectionType(const agxWire::ConnectingNode *connectingNode)
agxWire::ILinkNode * getConnectingNode(const agxWire::Link *link) const
agxWire::ILinkNode * getConnectingNode(const agxWire::Wire *wire) const
agx::Vector< agxWire::ILinkNodeRef > ConnectionsContainer
agx::Bool connect(agxWire::Wire *wire, const agx::Vec3 &relativeTranslate, agxWire::Link::ConnectionType type)
Maps this link to wire at given connection type (WIRE_BEGIN/WIRE_END).
Winch object which works like agxWire::WireWinchController but enables the features of having stored,...
Interface and placeholder of controllers/helpers for wires.
The base class for a constraint.
Base class providing referencing counted objects.
The rigid body class, combining a geometric model and a frame of reference.
size_t find(const T2 &element) const
Find the index to a matching element, return size() if not found.
void reserve(size_t size)
Reserve capacity in the vector.
void push_back(const T2 &value)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
Implements a Wire model with adaptive resolution.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.