AGX Dynamics  2.35.0.1
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 
52 
57 
62 
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 
144 
145  inline int getNumDOF() const override { return 4; }
146 
148 
149  protected:
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 
#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
#define AGXPHYSICS_EXPORT
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
AreaDefinition that specifies an area in which an eye node can move in an EyeNodeArea constraint.
Definition: EyeNodeArea.h:31
virtual void render(agxRender::RenderManager *, float) const
Optional debug rendering of this boundary.
Definition: EyeNodeArea.h:71
agx::RigidBody * getRigidBody()
agx::observer_ptr< agx::RigidBody > m_body
Definition: EyeNodeArea.h:85
virtual void restore(agxStream::InputArchive &in) override
agx::observer_ptr< agxWire::EyeNode > m_eyeNode
Definition: EyeNodeArea.h:88
virtual void store(agxStream::OutputArchive &out) const override
agx::Vec3 getLocalDirection()
agx::Vec3 getLocalCenter()
agx::Vec3 m_localDirection
Definition: EyeNodeArea.h:87
agxWire::EyeNode * getEyeNode()
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agxWire::AreaDefinition)
virtual bool getOverlap(agx::Vec3 &pointOnBoundary, agx::Vec3 &dirTowardsCenter, agx::Real &overlap, agx::Vec3 &tangent)=0
Callback from EyeNodeArea to fetch information about the boundary.
AreaDefinition(agx::RigidBody *rb, agx::Vec3 localCenter, agx::Vec3 localDirection, agxWire::EyeNode *eyeNode)
Class for defining a circular area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:166
virtual bool getOverlap(agx::Vec3 &pointOnBoundary, agx::Vec3 &dirTowardsCenter, agx::Real &overlap, agx::Vec3 &tangent) override
Callback from EyeNodeArea to fetch information about the boundary.
CircularAreaDefinition(const agx::Vec3 &localCenter, agx::Real radius, agx::RigidBody *body, const agx::Vec3 &localLineDir, agxWire::EyeNode *eyeNode)
Circular area definition given center of circle (localCenter), radius, body, line direction in body c...
Class for defining a convex area in which the eye node is allowed to exist.
Definition: EyeNodeArea.h:199
virtual void render(agxRender::RenderManager *mgr, float) const override
Optional debug rendering of this boundary.
ConvexAreaDefinition(const agx::Vec3 &localCenter, const agx::Vec3Vector &areaCoordinates, agx::RigidBody *body, const agx::Vec3 &localLineDir, agxWire::EyeNode *eyeNode)
Convex area definition given center of area (localCenter), vector of local points that defines the co...
agx::Vec3Vector m_areaCoordinates
Definition: EyeNodeArea.h:224
virtual bool getOverlap(agx::Vec3 &pointOnBoundary, agx::Vec3 &dirTowardsCenter, agx::Real &overlap, agx::Vec3 &tangent) override
Callback from EyeNodeArea to fetch information about the boundary.
Constraint that allows an eye node to move in a 2D area relative a rigid body.
Definition: EyeNodeArea.h:97
virtual agx::Real getBoundaryFrictionCompliance() const
virtual void setBoundaryFrictionCompliance(agx::Real compliance)
Assign compliance to the boundary friction constraint.
virtual void render(agxRender::RenderManager *mgr, float scale) const override
Inherited method of how to render this constraint into DebugRenderer.
EyeNodeArea(AreaDefinition *areaDefinition)
Construct the two body joint given an area definition.
virtual void setDamping(agx::Real damping, agx::Int=-1) override
Assign damping in the constraints, except boundary friction constraint which has explicit method.
virtual agx::Real getDamping(agx::UInt) const override
virtual agx::Real getCompliance(agx::UInt) const override
virtual void setCompliance(agx::Real compliance, agx::Int=-1) override
Assign compliance in the constraints, except boundary friction constraint which has explicit method.
int getNumDOF() const override
Definition: EyeNodeArea.h:145
Eye node is a type of node that can slide along a wire with or without friction.
The base class for a constraint.
Definition: Constraint.h:89
Base class providing referencing counted objects.
Definition: Referenced.h:114
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
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
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.
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:40
agx::ref_ptr< EyeNodeArea > EyeNodeAreaRef
Definition: EyeNodeArea.h:159
agx::ref_ptr< AreaDefinition > AreaDefinitionRef
Definition: EyeNodeArea.h:91
int32_t Int
Definition: Integer.h:35
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42