AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WireImpactController.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
21
23
25
26
27#define WIRE_IMPACT_EPSILON ((double)1E-6)
28
29
30namespace agx
31{
32 class DebugRendererCache;
33}
34
35namespace agxCollide
36{
37 class Box;
38 class Cylinder;
39 class Mesh;
40}
41
42namespace agxWire
43{
44 // Forward declarations
45 class WireGeometryController;
46
48
49
50 namespace NodeInvalidFlag
51 {
53 enum Enum { VALID = 0, VALID_CIRCLE_CONTACT, INVALID_PLANE_ANGLE_OR_SAME_EDGE_TEST, INVALID_PASSED_EDGE_TEST, INVALID_PENETRATION_DEPTH_TOO_LARGE, INVALID_SAME_EDGE_TEST, INVALID };
54 }
56
57 // Small class used to render contact points handled by this controller
58 class WireImpactRenderer : public agxSDK::StepEventListener
59 {
60 public:
61 WireImpactRenderer();
62
63 virtual void preCollide( const agx::TimeStamp& /*t*/ )
64 {
66 m_clnPND.clear( ContactWireNodeRefPointNormalDepthTable::MAINTAIN_BUFFER );
67 m_wires.clear();
68 }
69
70 void add( const agxCollide::GeometryContact* geometryContact, bool used = true );
71 void add( const agxCollide::ContactPoint& point, bool used = true );
72 void add( const agxCollide::ContactPoint& point, NodeInvalidFlag::Enum renderFlag );
73 void add( ContactNode* cln );
74 void add( const agx::Vec3& p1, const agx::Vec3& p2, const agx::Vec3& color );
75 void changeRenderFlag( ContactNode* cln, NodeInvalidFlag::Enum renderFlag );
76
77 void render( agxRender::RenderManager *mgr ) const;
78
79 protected:
80 virtual ~WireImpactRenderer() {}
81
82 private:
83 struct PointNormalDepth
84 {
85 PointNormalDepth() : depth( 0 ), renderFlag( NodeInvalidFlag::VALID ) {}
86 PointNormalDepth( agx::Real d, const agx::Vec3& n, const agx::Vec3& p, NodeInvalidFlag::Enum flag )
87 : depth( d ), normal( n ), point( p ), renderFlag( flag ) {}
88 agx::Real depth;
89 agx::Vec3 normal;
90 agx::Vec3 point;
91 NodeInvalidFlag::Enum renderFlag;
92 };
93 typedef agx::HashTable< ContactNodeRef, PointNormalDepth > ContactWireNodeRefPointNormalDepthTable;
94
95 ContactWireNodeRefPointNormalDepthTable m_clnPND;
99 agx::Vector< std::string > m_descriptions;
100 };
101
102 typedef agx::ref_ptr< WireImpactRenderer > WireImpactRendererRef;
103
109 class AGXPHYSICS_EXPORT WireImpactController : public agx::Referenced
110 {
111 public:
112 WireImpactController();
113
117 virtual void addNotification();
118
122 virtual void removeNotification();
123
129 void setWire( WireDistanceCompositeConstraint* wire, WireGeometryController* geometryController );
130
135 virtual bool handleGeometryContact( agxCollide::GeometryContact* geometryContact );
136
137
138 protected:
142 virtual ~WireImpactController();
143
144
149 bool handleWire( agxCollide::GeometryContact* geometryContact, agxCollide::Geometry* otherGeometry );
150
154 agxSDK::SimulationProxy* getSimulationProxy() const;
155
156 protected:
157 friend class WireOldContactController;
158
159 protected:
161 WireGeometryController* m_geometryController;
162 };
163
164 typedef agx::ref_ptr< WireImpactController > WireImpactControllerRef;
165
166 inline agxSDK::SimulationProxy* WireImpactController::getSimulationProxy() const
167 {
168 return m_wire != nullptr ? m_wire->getSimulationProxy() : nullptr;
169 }
170}
171
173
#define AGXPHYSICS_EXPORT
A contact point in a contact data.
Definition Contacts.h:56
A contact between two geometries.
Definition Contacts.h:271
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Interface class used by internal objects running in parallel.
Inheritance with partial specialization due to bug with ref_ptr containers.
Base class providing referencing counted objects.
Definition Referenced.h:120
Templated vector class.
Definition agx/Vector.h:53
Smart pointer for observed objects, that automatically set pointers to them to null when they deleted...
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
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.
double Real
Definition Real.h:42
agx::Real TimeStamp
Definition TimeStamp.h:26