AGX Dynamics  2.37.3.2
EyeNodeArea.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/AngularLockJoint.h>
21 #include <agxWire/Node.h>
22 
23 
24 namespace agxWire
25 {
31  {
32  public:
45  virtual bool getOverlap( agx::Vec3& pointOnBoundary, agx::Vec3& dirTowardsCenter, agx::Real& overlap,
46  agx::Vec3& tangent ) = 0;
47 
51  agx::Vec3 getLocalCenter();
52 
56  agx::RigidBody* getRigidBody();
57 
61  agx::Vec3 getLocalDirection();
62 
66  agxWire::EyeNode* getEyeNode();
67 
71  virtual void render( agxRender::RenderManager *, float /*scale*/ ) const {}
72 
74 
75  protected:
76  AreaDefinition( agx::RigidBody* rb, agx::Vec3 localCenter, agx::Vec3 localDirection, agxWire::EyeNode* eyeNode );
77 
78  virtual ~AreaDefinition() {}
79 
80  virtual void store( agxStream::OutputArchive& out ) const override;
81 
82  virtual void restore( agxStream::InputArchive& in ) override;
83 
84  protected:
89  };
90 
92 
97  {
98  public:
104  EyeNodeArea( AreaDefinition* areaDefinition );
105 
112  virtual void setCompliance( agx::Real compliance, agx::Int /*i*/ = -1 ) override;
113 
120  virtual void setDamping( agx::Real damping, agx::Int /*i*/ = -1 ) override;
121 
125  virtual agx::Real getCompliance( agx::UInt /*i*/ ) const override;
126 
130  virtual agx::Real getDamping( agx::UInt /*i*/ ) const override;
131 
138  virtual void setBoundaryFrictionCompliance( agx::Real compliance );
139 
143  virtual agx::Real getBoundaryFrictionCompliance() const;
144 
145  inline int getNumDOF() const override { return 4; }
146 
148 
149  protected:
150  EyeNodeArea();
151  virtual ~EyeNodeArea();
152 
153  virtual void render( agxRender::RenderManager* mgr, float scale ) const override;
154 
155  private:
156  class EyeNodeAreaImplementation* m_implementation;
157  };
158 
160 
161 
166  {
167  public:
172  CircularAreaDefinition( const agx::Vec3& localCenter,
173  agx::Real radius,
174  agx::RigidBody* body,
175  const agx::Vec3& localLineDir,
176  agxWire::EyeNode* eyeNode );
177 
179 
181 
183  {
184  }
185 
186  protected:
187 
188  virtual bool getOverlap( agx::Vec3& pointOnBoundary, agx::Vec3& dirTowardsCenter, agx::Real& overlap,
189  agx::Vec3& tangent ) override;
190 
191  protected:
193  };
194 
199  {
200  public:
206  ConvexAreaDefinition( const agx::Vec3& localCenter,
207  const agx::Vec3Vector& areaCoordinates,
208  agx::RigidBody* body,
209  const agx::Vec3& localLineDir,
210  agxWire::EyeNode* eyeNode );
211 
213 
214  protected:
217 
218  virtual bool getOverlap( agx::Vec3& pointOnBoundary, agx::Vec3& dirTowardsCenter, agx::Real& overlap,
219  agx::Vec3& tangent ) override;
220 
221  virtual void render( agxRender::RenderManager *mgr, float /*scale*/ ) const override;
222 
223  protected:
224  agx::Vec3Vector m_areaCoordinates; // In body coordinates
225  };
226 }
227 
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...
Definition: InputArchive.h:400
agx::ref_ptr< EyeNodeArea > EyeNodeAreaRef
Definition: EyeNodeArea.h:159
agx::Vec3 m_localDirection
Definition: EyeNodeArea.h:87
AGXFMI_EXPORT InputVariable_Real * setCompliance(agx::Constraint *constraint)
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...
Constraint that allows an eye node to move in a 2D area relative a rigid body.
Definition: EyeNodeArea.h:96
int getNumDOF() const override
Definition: EyeNodeArea.h:145
#define AGXPHYSICS_EXPORT
Class for defining a circular area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:165
The base class for a constraint.
Definition: Constraint.h:88
int32_t Int
Definition: Integer.h:35
agx::Vec3Vector m_areaCoordinates
Definition: EyeNodeArea.h:224
Class for defining a convex area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:198
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
virtual void render(agxRender::RenderManager *, float) const
Optional debug rendering of this boundary.
Definition: EyeNodeArea.h:71
Base class providing referencing counted objects.
Definition: Referenced.h:119
uint32_t UInt
Definition: Integer.h:34
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::ref_ptr< AreaDefinition > AreaDefinitionRef
Definition: EyeNodeArea.h:91
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
AreaDefinition that specifies an area in which an eye node can move in an EyeNodeArea constraint...
Definition: EyeNodeArea.h:30
AGXFMI_EXPORT InputVariable_Real * setDamping(agx::Constraint *constraint)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agx::observer_ptr< agx::RigidBody > m_body
Definition: EyeNodeArea.h:85
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:221
double Real
Definition: Real.h:42
Eye node is a type of node that can slide along a wire with or without friction.
agx::observer_ptr< agxWire::EyeNode > m_eyeNode
Definition: EyeNodeArea.h:88