AGXDynamics  2.35.0.2
ShapeContactNode.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 <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 
223 
224  agx::Real calculateMass(const Wire* wire) const;
225 
229  int state;
230 
231  };
232 
236 
239 
240 
241 }
242 
agx::Real
double Real
Definition: Real.h:42
agx::List
Definition: List.h:107
agx::Vector
Templated vector class.
Definition: Vector.h:52
agxWire::ContactNodeData::existancePolicy
ShapeContactNode::NodeExistancePolicy existancePolicy
Definition: ShapeContactNode.h:228
agxWire::ContactNodeData
Definition: ShapeContactNode.h:218
agxWire::ContactNodeData::contactNode
ShapeContactNode * contactNode
Definition: ShapeContactNode.h:226
agxWire::ShapeContactNode::ContactState
ContactState
Definition: ShapeContactNode.h:37
agxWire::ShapeContactNodeRef
agx::ref_ptr< ShapeContactNode > ShapeContactNodeRef
Definition: ShapeContactNode.h:24
agxWire::Wire
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:61
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
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
Node.h
agxWire::ContactNodeData::contactNodeIt
NodeConstIterator contactNodeIt
Definition: ShapeContactNode.h:227
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agxWire::ContactNodeData::calculateMass
agx::Real calculateMass(const Wire *wire) const
agxWire::ShapeContactNode
Definition: ShapeContactNode.h:28
agxCollide::Shape
Base class for a shape.
Definition: Shape.h:53
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agxWire::ContactNodeDataList
agx::List< ContactNodeData > ContactNodeDataList
Definition: ShapeContactNode.h:234
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::ContactNodeDataSet
agx::HashSet< ContactNodeData * > ContactNodeDataSet
Definition: ShapeContactNode.h:233
agx::HashSet
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: HashSet.h:665
agx::List::const_iterator
Definition: List.h:122
agxWire::ContactNodeDataListVector
agx::Vector< ContactNodeDataList > ContactNodeDataListVector
Definition: ShapeContactNode.h:235
agx::Bool
bool Bool
Definition: Integer.h:48
agx::Vec3T< Real >
agxWire::ContactNodeDataListIterator
ContactNodeDataList::const_iterator ContactNodeDataListIterator
Definition: ShapeContactNode.h:237
agxWire::Node
Class defining a node that is part of a wire.
Definition: agxWire/Node.h:511
agxWire::ContactNodeDataListIteratorList
agx::List< ContactNodeDataListIterator > ContactNodeDataListIteratorList
Definition: ShapeContactNode.h:238
agxWire::ContactNodeData::state
int state
Definition: ShapeContactNode.h:229
agxWire::ShapeContactNode::NodeExistancePolicy
NodeExistancePolicy
Definition: ShapeContactNode.h:32
agxWire::ContactNodeData::ContactNodeData
ContactNodeData()
ShapeContactEdge.h