AGXDynamics  2.35.0.2
EyeNodeArea.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
agxWire::EyeNodeArea
Constraint that allows an eye node to move in a 2D area relative a rigid body.
Definition: EyeNodeArea.h:96
agxWire::AreaDefinition::m_body
agx::observer_ptr< agx::RigidBody > m_body
Definition: EyeNodeArea.h:85
agx::Real
double Real
Definition: Real.h:42
agxWire::AreaDefinition::~AreaDefinition
virtual ~AreaDefinition()
Definition: EyeNodeArea.h:78
agxStream::out
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.
Definition: OutputArchive.h:412
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
agxStream::Serializable
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
agxRender::RenderManager
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Definition: RenderManager.h:106
agxWire::CircularAreaDefinition::~CircularAreaDefinition
virtual ~CircularAreaDefinition()
Definition: EyeNodeArea.h:182
agx::Int
int32_t Int
Definition: Integer.h:35
agxWire::ConvexAreaDefinition::m_areaCoordinates
agx::Vec3Vector m_areaCoordinates
Definition: EyeNodeArea.h:224
agxWire::AreaDefinition
AreaDefinition that specifies an area in which an eye node can move in an EyeNodeArea constraint.
Definition: EyeNodeArea.h:30
agxWire::ConvexAreaDefinition
Class for defining a convex area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:198
agxFMI2::Export::Constraint::setCompliance
AGXFMI_EXPORT InputVariable_Real * setCompliance(agx::Constraint *constraint)
ConstraintImplementation.h
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
#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
agxWire::AreaDefinition::m_localCenter
agx::Vec3 m_localCenter
Definition: EyeNodeArea.h:86
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agx::VectorPOD< Vec3 >
agx::observer_ptr< agx::RigidBody >
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxStream::in
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
agxWire::CircularAreaDefinition
Class for defining a circular area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:165
agxWire::EyeNodeArea::getNumDOF
int getNumDOF() const override
Definition: EyeNodeArea.h:145
Node.h
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
AngularLockJoint.h
agxWire::AreaDefinitionRef
agx::ref_ptr< AreaDefinition > AreaDefinitionRef
Definition: EyeNodeArea.h:91
agxWire::CircularAreaDefinition::m_radius
agx::Real m_radius
Definition: EyeNodeArea.h:192
agxWire::AreaDefinition::render
virtual void render(agxRender::RenderManager *, float) const
Optional debug rendering of this boundary.
Definition: EyeNodeArea.h:71
agxWire::AreaDefinition::m_localDirection
agx::Vec3 m_localDirection
Definition: EyeNodeArea.h:87
agxWire::EyeNode
Eye node is a type of node that can slide along a wire with or without friction.
Definition: agxWire/Node.h:1380
agxWire::ConvexAreaDefinition::~ConvexAreaDefinition
virtual ~ConvexAreaDefinition()
Definition: EyeNodeArea.h:216
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
agxWire::AreaDefinition::m_eyeNode
agx::observer_ptr< agxWire::EyeNode > m_eyeNode
Definition: EyeNodeArea.h:88
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
agx::UInt
uint32_t UInt
Definition: Integer.h:34
agx::Constraint
The base class for a constraint.
Definition: Constraint.h:88
agxFMI2::Export::Constraint::setDamping
AGXFMI_EXPORT InputVariable_Real * setDamping(agx::Constraint *constraint)
agx::Vec3T< Real >
agxWire::EyeNodeAreaRef
agx::ref_ptr< EyeNodeArea > EyeNodeAreaRef
Definition: EyeNodeArea.h:159