AGX Dynamics  2.37.3.2
ShapeContactNode.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 <agxWire/Node.h>
21 
22 namespace agxWire
23 {
26  class ShapeContactColliderUtils;
27 
29  {
30  public:
31 
33  {
34  KEEP = 0, REMOVE, REPLACE, REMOVED
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  LEAVING_GYPSY = 1 << 8
49 
50  };
51 
52  static ShapeContactNode* createFromWorld(agxCollide::Shape* shape, const agx::Real& wireRadius, const agx::Vec3& surfacePosition, const ShapeCurvature& worldCurvature);
53  static ShapeContactNode* getAsShapeContact(agxWire::Node* node);
54  static const ShapeContactNode* getAsShapeContact(const agxWire::Node* node);
55 
56  public:
57 
60  ShapeContactNode(agxCollide::Shape* shape, const agx::Real& wireRadius, const agx::Vec3& shapeLocalPoint);
61 
75  agx::Bool initialize(const Wire* wire, const Node* prevNode, const Node* nextNode, const agx::Vec3& surfacePoint);
76 
77 
82  agx::Bool hasCylinderContactState() const;
83 
91  agx::Bool handleCylinderContact();
92 
96  agx::Bool isNearClampPosition(const agx::Real& edgeDefaultLength) const;
97 
101  const agxCollide::Shape* getShape() const;
102 
106  agxCollide::Shape* getShape();
107 
111  ShapeContactEdge& getShapeContactEdge();
112  const ShapeContactEdge& getShapeContactEdge() const;
113 
118  void setWorldPosition(const agx::Vec3& worldPosition);
119 
123  agx::Vec3& velocity();
124 
128  virtual agx::Vec3 getVelocity() const override;
129 
133  void setVelocity( const agx::Vec3& velocity );
134 
138  agx::Real getEdgeVelocity() const;
139 
143  void setEdgeVelocity(const agx::Real& vel);
144 
148  agx::Vec3 getWorldSurfaceNormal() const;
149 
153  agx::Vec3 getWorldEdgeNormal() const;
154 
158  void getWorldEdgeEnds(agx::Vec3& edgeStart, agx::Vec3& edgeEnd);
159 
163  agx::Real getEdgeStart() const;
164 
168  agx::Real getEdgeEnd() const;
169 
173  agx::Vec3 getShapeSurfaceNormal() const;
174  agx::Vec3 getShapeEdgeNormal() const;
175  agx::Vec3 getShapeTranslate() const;
176 
180  void setShapeTranslate( const agx::Vec3& localPos);
181 
185  agx::Real getExtraLength() const;
186 
191  void setExtraLength(const agx::Real extraLength);
192 
196  void setShapeContactEdge(ShapeContactEdge& shapeContactEdge);
197 
201  void resetEdgeLength(agx::Real edgeHalfLength);
202 
204 
205  protected:
206  virtual ~ShapeContactNode();
207 
208  private:
209  agx::Real m_extraLength;
210 
211  agx::Vec3 m_velocity;
212 
213  ShapeContactEdge m_shapeEdge;
214 
215  };
216 
217 
219  {
220  ContactNodeData();
221 
222  ContactNodeData(ShapeContactNode* contactNode, NodeConstIterator contactNodeIt);
223 
224  agx::Real calculateMass(const Wire* wire) const;
225 
229  int state;
230 
231  };
232 
236 
239 
240 
241 }
242 
ContactNodeDataList::const_iterator ContactNodeDataListIterator
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: HashSet.h:669
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:207
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.