AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WireController.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxWire/Wire.h>
20#include <agxWire/WireHandler.h>
22
23#include <agxSDK/Simulation.h>
24
26#include <agx/Singleton.h>
27
28namespace agxWire
29{
55 {
56 public:
63 typedef std::pair< agxSDK::SimulationObserver, WireParallelCallbacksHandlerRef > SimulationObsWireParallelCallbacksHandlerRefPair;
64 typedef std::pair< agxSDK::SimulationObserver, WirePtrContainer > SimulationObsWirePtrContainerPair;
67
68 public:
72 enum State
73 {
74 EXPLICIT_ENABLE = (1<<0),
75 ALL_ENABLE = (1<<1),
76 USE_DYNAMIC_CONTACTS = (1<<2),
77 DEFAULT = EXPLICIT_ENABLE
78 };
79
80 public:
85
90 bool isWireWireActive() const;
91
100 bool setEnableCollisions( agxWire::Wire* wire1, agxWire::Wire* wire2, bool enable );
101
107 bool getEnableCollisions( const agxWire::Wire* wire1, const agxWire::Wire* wire2 ) const;
108
122
136
141
146
151
156
160 agxWire::WireHandler* getOrCreateWireHandler( agxSDK::Simulation* simulation );
161
165 agxWire::WireParallelCallbacksHandler* getOrCreateWireParallelCallbacksHandler( agxSDK::Simulation* simulation );
166
171
175 agxWire::WireHandler* find( const agxSDK::Simulation* simulation );
176
180 agxSDK::Simulation* find( agxWire::WireHandler* handler ) const;
181
186 WireIterator getBeginWireIterator() const;
187
191 WireIterator getEndWireIterator() const;
192
198
203
208
210
211
215 agxWire::Wire* findWire(agx::UInt32 id) const;
216
221 agxWire::Wire* findWire(const agxCollide::Geometry* geometry) const;
222
226 bool add(agxSDK::Simulation* simulation, agxWire::WireHandler* wireHandler);
227
231 bool remove(agxWire::WireHandler* wireHandler);
232
236 agx::UInt getStateMask() const;
237
241 void setStateMask( agx::UInt stateMask );
242
247 void addState( State state );
248
253 void removeState( State state );
254
259 agx::Bool hasState( State state ) const;
260
264 const agxWire::WireController::IdWireContainer& getIdWireContainer() const;
265
269 agxWire::WireController::WirePtrContainer getSimplifiedWires(const agxSDK::Simulation* simulation) const;
270
274 void registerParallelHandlerFactory(agxWire::WireParallelCallbacksHandlerFactory* factory);
275
279 agxWire::WireParallelCallbacksHandlerFactory* getParallelHandlerFactory() const;
280
284 agx::ReentrantMutex& getMutex();
285
287
291 const agxWire::WireController::WirePtrContainer& getAllWires() const;
292
293
294 protected:
296 virtual ~WireController();
297
298 virtual void shutdown() override;
299
300 friend class Wire;
301 friend class WireGeometryController;
302 friend class WireSimplifyController;
303
307 void onCreate( agxWire::Wire* wire );
308
312 void onAddNotification( agxWire::Wire* wire );
313
317 void onDelete( agxWire::Wire* wire );
318
322 void onRemoveNotification( agxWire::Wire* wire );
323
327 void updateId( agxWire::Wire* wire );
328
332 void onSimplify( agxSDK::Simulation* simulation, agxWire::Wire* wire );
333
337 void onUnsimplify( agxSDK::Simulation* simulation, agxWire::Wire* wire );
338
339 SINGLETON_CLASSNAME_METHOD();
340
341 protected:
343 WireWireContainer m_enabledWires;
345 WireHandlerContainer m_wireHandlers;
346 WireParallelCallbacksHandlerFactoryRef m_parallelCallbacksFactory;
347 WireParallelCallbacksHandlerContainer m_parallelCallbacksHandlers;
348 SimplifiedWiresContainer m_simplifiedWires;
349 agx::UInt m_state;
350 agx::ReentrantMutex m_mutex;
351 private:
352 static WireController* s_instance;
353 };
354
356 {
357 return m_wires.begin();
358 }
359
360 AGX_FORCE_INLINE WireController::WireIterator WireController::getEndWireIterator() const
361 {
362 return m_wires.end();
363 }
364}
365
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Overlaying object handling wires.
agx::Vector< SimulationObsWirePtrContainerPair > SimplifiedWiresContainer
void setEnableDynamicWireContactsGlobally(agx::Bool enable)
Force all wire contacts to be dynamic.
agx::HashVector< agx::UInt32, agx::observer_ptr< agxWire::Wire > > IdWireContainer
agx::SymmetricPair< agx::observer_ptr< agxWire::Wire > > WireWireSymmetricPair
State
Internal state handling.
agx::Vector< WireWireSymmetricPair > WireWireContainer
const WireWireContainer & getEnabledWireWirePairs() const
Internal method.
agx::Vector< WireHandlerRef > WireHandlerContainer
agx::Bool getEnableDynamicWireContactsGlobally() const
std::pair< agxSDK::SimulationObserver, WireParallelCallbacksHandlerRef > SimulationObsWireParallelCallbacksHandlerRefPair
agx::UInt getNumWires() const
Can be used to iterate over all wires in a script language that e.g., not support iterators.
agx::Bool setEnableDynamicWireContacts(agxCollide::Geometry *geometry, agx::Bool enable)
Enable, or disable, the use of dynamic wire contact model against this geometry.
agx::Bool setEnableDynamicWireContacts(agx::RigidBody *rb, agx::Bool enable)
Enable, or disable, the use of dynamic wire contact model against this rigid body.
bool getEnableCollisions(const agxWire::Wire *wire1, const agxWire::Wire *wire2) const
bool isWireWireActive() const
agx::SetVector< agxWire::Wire * > WirePtrContainer
agxWire::WireParallelCallbacksHandler * getOrCreateWireParallelCallbacksHandler(agxSDK::Simulation *simulation)
agx::Bool getEnableDynamicWireContacts(const agx::RigidBody *rb) const
agxWire::Wire * getWire(agx::UInt index) const
agx::Vector< SimulationObsWireParallelCallbacksHandlerRefPair > WireParallelCallbacksHandlerContainer
void removeParallelCallbackHandler(agxSDK::Simulation *simulation)
Removes object.
bool setEnableCollisions(agxWire::Wire *wire1, agxWire::Wire *wire2, bool enable)
Enable, or disable, collision detection and contacts between two wires.
agxWire::WireHandler * getOrCreateWireHandler(agxSDK::Simulation *simulation)
agxWire::WireHandler * find(const agxSDK::Simulation *simulation)
static WireController * instance()
agx::Bool getEnableDynamicWireContacts(const agxCollide::Geometry *geometry) const
std::pair< agxSDK::SimulationObserver, WirePtrContainer > SimulationObsWirePtrContainerPair
WirePtrContainer::const_iterator WireIterator
agxSDK::Simulation * find(agxWire::WireHandler *handler) const
Interface and placeholder of controllers/helpers for wires.
Definition Wire.h:62
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition HashVector.h:41
The rigid body class, combining a geometric model and a frame of reference.
Definition RigidBody.h:52
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition SetVector.h:38
iterator begin()
Definition SetVector.h:276
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
Definition Singleton.h:31
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a)
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
#define AGX_FORCE_INLINE
Definition macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
Implements a Wire model with adaptive resolution.
Definition MergedBody.h:40
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition Integer.h:40
uint64_t UInt
Definition Integer.h:27