AGXDynamics  2.31.1.0
ShapeContactNode.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 <agxWire/Node.h>
21 
22 namespace agxWire
23 {
26  class ShapeContactColliderUtils;
27 
29  {
30  public:
31 
33  {
34  KEEP = 0, REMOVE, REPLACE
35  };
36 
38  {
39  NO_ISSUES = 0,
40  PREV_IS_CLOSE = 1 << 0,
41  NEXT_IS_CLOSE = 1 << 1,
42  PREV_HAS_SAME_NORMAL = 1 << 2,
43  NEXT_HAS_SAME_NORMAL = 1 << 3,
44  ANGLE_NOT_VALID = 1 << 4,
45  NEAR_CLAMP_POSITION = 1 << 5,
46  WORTHLESS_MIDDLE_CONTACT = 1 << 6,
47  REMOVE_IMEDIATELY = 1 << 7
48 
49  };
50 
51  static ShapeContactNode* createFromWorld(agxCollide::Shape* shape, const agx::Real& wireRadius, const agx::Vec3& surfacePosition, const ShapeCurvature& worldCurvature);
52  static ShapeContactNode* getAsShapeContact(agxWire::Node* node);
53  static const ShapeContactNode* getAsShapeContact(const agxWire::Node* node);
54 
55  public:
56 
59  ShapeContactNode(agxCollide::Shape* shape, const agx::Real& wireRadius, const agx::Vec3& shapeLocalPoint);
60 
74  agx::Bool initialize(const Wire* wire, const Node* prevNode, const Node* nextNode, const agx::Vec3& surfacePoint);
75 
76 
81  agx::Bool hasCylinderContactState() const;
82 
90  agx::Bool handleCylinderContact();
91 
95  agx::Bool isNearClampPosition(const agx::Real& edgeDefaultLength) const;
96 
100  const agxCollide::Shape* getShape() const;
101 
105  agxCollide::Shape* getShape();
106 
110  ShapeContactEdge& getShapeContactEdge();
111  const ShapeContactEdge& getShapeContactEdge() const;
112 
117  void setWorldPosition(const agx::Vec3& worldPosition);
118 
122  agx::Vec3& velocity();
123 
127  virtual agx::Vec3 getVelocity() const override;
128 
132  void setVelocity( const agx::Vec3& velocity );
133 
137  agx::Real getEdgeVelocity() const;
138 
142  void setEdgeVelocity(const agx::Real& vel);
143 
147  agx::Vec3 getWorldSurfaceNormal() const;
148 
152  agx::Vec3 getWorldEdgeNormal() const;
153 
157  void getWorldEdgeEnds(agx::Vec3& edgeStart, agx::Vec3& edgeEnd);
158 
162  agx::Real getEdgeStart() const;
163 
167  agx::Real getEdgeEnd() const;
168 
172  agx::Vec3 getShapeSurfaceNormal() const;
173  agx::Vec3 getShapeEdgeNormal() const;
174  agx::Vec3 getShapeTranslate() const;
175 
179  void setShapeTranslate( const agx::Vec3& localPos);
180 
184  agx::Real getExtraLength() const;
185 
190  void setExtraLength(const agx::Real extraLength);
191 
195  void setShapeContactEdge(ShapeContactEdge& shapeContactEdge);
196 
200  void resetEdgeLength(agx::Real edgeHalfLength);
201 
203 
204  protected:
205  virtual ~ShapeContactNode();
206 
207  private:
208  agx::Real m_extraLength;
209 
210  agx::Vec3 m_velocity;
211 
212  ShapeContactEdge m_shapeEdge;
213 
214  };
215 
216 
218  {
219  ContactNodeData();
220 
221  ContactNodeData(ShapeContactNode* contactNode, NodeConstIterator contactNodeIt);
222 
223  agx::Real calculateMass(const Wire* wire) const;
224 
228  int state;
229 
230  };
231 
235 
238 
239 
240 }
241 
ContactNodeDataList::const_iterator ContactNodeDataListIterator
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: HashSet.h:665
ShapeContactNode::NodeExistancePolicy existancePolicy
bool Bool
Definition: Integer.h:48
Base class for a shape.
Definition: Shape.h:53
#define AGXPHYSICS_EXPORT
agx::ref_ptr< ShapeContactNode > ShapeContactNodeRef
Templated vector class.
Definition: Vector.h:52
agx::HashSet< ContactNodeData *> ContactNodeDataSet
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:61
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agx::List< ContactNodeData > ContactNodeDataList
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::Vector< ContactNodeDataList > ContactNodeDataListVector
ShapeContactNode * contactNode
#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:206
NodeConstIterator contactNodeIt
Class defining a node that is part of a wire.
Definition: agxWire/Node.h:511
double Real
Definition: Real.h:42
agx::List< ContactNodeDataListIterator > ContactNodeDataListIteratorList
Eye node is a type of node that can slide along a wire with or without friction.