AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
ShapeContactNode.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agxWire/Node.h>
21
22namespace agxWire
23{
24 class ShapeContactNode;
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);
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
83
92
96 agx::Bool isNearClampPosition(const agx::Real& edgeDefaultLength) const;
97
102
107
111 ShapeContactEdge& getShapeContactEdge();
112 const ShapeContactEdge& getShapeContactEdge() const;
113
118 void setWorldPosition(const agx::Vec3& worldPosition);
119
124
128 virtual agx::Vec3 getVelocity() const override;
129
133 void setVelocity( const agx::Vec3& velocity );
134
139
143 void setEdgeVelocity(const agx::Real& vel);
144
149
154
158 void getWorldEdgeEnds(agx::Vec3& edgeStart, agx::Vec3& edgeEnd);
159
164
169
176
180 void setShapeTranslate( const agx::Vec3& localPos);
181
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:
207
208 private:
209 agx::Real m_extraLength;
210
211 agx::Vec3 m_velocity;
212
213 ShapeContactEdge m_shapeEdge;
214
215 };
216
217
219 {
221
223
224 agx::Real calculateMass(const Wire* wire) const;
225
229 int state;
230
231 };
232
236
237 typedef ContactNodeDataList::const_iterator ContactNodeDataListIterator;
239
240
241}
242
#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
Base class for a shape.
Definition: Shape.h:58
Eye node is a type of node that can slide along a wire with or without friction.
Class defining a node that is part of a wire.
Definition: agxWire/Node.h:512
agx::Real getEdgeStart() const
virtual agx::Vec3 getVelocity() const override
const ShapeContactEdge & getShapeContactEdge() const
void setWorldPosition(const agx::Vec3 &worldPosition)
Position the node in world coordinates.
void setExtraLength(const agx::Real extraLength)
Set the extra lenght of this node this timestep.
void setShapeTranslate(const agx::Vec3 &localPos)
Update position using a local translate.
agx::Vec3 getWorldEdgeNormal() const
agx::Bool handleCylinderContact()
Treat special cases where the node shape is a cylinder and hasCylinderContactState() return true.
void getWorldEdgeEnds(agx::Vec3 &edgeStart, agx::Vec3 &edgeEnd)
Returns the edge start and end position in world coordinates.
ShapeContactNode(agxCollide::Shape *shape, const agx::Real &wireRadius, const agx::Vec3 &shapeLocalPoint)
agxCollide::Shape * getShape()
const agxCollide::Shape * getShape() const
agx::Vec3 getShapeEdgeNormal() const
agx::Vec3 getWorldSurfaceNormal() const
agx::Real getEdgeEnd() const
ShapeContactNode(agxCollide::Shape *shape)
agx::Real getExtraLength() const
static ShapeContactNode * createFromWorld(agxCollide::Shape *shape, const agx::Real &wireRadius, const agx::Vec3 &surfacePosition, const ShapeCurvature &worldCurvature)
static const ShapeContactNode * getAsShapeContact(const agxWire::Node *node)
agx::Real getEdgeVelocity() const
static ShapeContactNode * getAsShapeContact(agxWire::Node *node)
void setEdgeVelocity(const agx::Real &vel)
set the velocity of the node along it's edge.
void setShapeContactEdge(ShapeContactEdge &shapeContactEdge)
Set an edge to the node, containing shape etc.
ShapeContactEdge & getShapeContactEdge()
agx::Bool initialize(const Wire *wire, const Node *prevNode, const Node *nextNode, const agx::Vec3 &surfacePoint)
Initialize the node:
agx::Bool hasCylinderContactState() const
Find out if the node is a cylinder contact.
void setVelocity(const agx::Vec3 &velocity)
Set the velocity of the node in world coordinates.
void resetEdgeLength(agx::Real edgeHalfLength)
Undo all clamping.
agx::Bool isNearClampPosition(const agx::Real &edgeDefaultLength) const
agx::Vec3 getShapeSurfaceNormal() const
Get data in shape coordinates.
agx::Vec3 getShapeTranslate() const
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:62
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: agx/HashSet.h:670
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
NodeContainer::const_iterator NodeConstIterator
Definition: agxWire/Node.h:57
ContactNodeDataList::const_iterator ContactNodeDataListIterator
agx::HashSet< ContactNodeData * > ContactNodeDataSet
agx::List< ContactNodeDataListIterator > ContactNodeDataListIteratorList
agx::ref_ptr< ShapeContactNode > ShapeContactNodeRef
agx::List< ContactNodeData > ContactNodeDataList
agx::Vector< ContactNodeDataList > ContactNodeDataListVector
bool Bool
Definition: Integer.h:40
double Real
Definition: Real.h:41
agx::Real calculateMass(const Wire *wire) const
ShapeContactNode * contactNode
ContactNodeData(ShapeContactNode *contactNode, NodeConstIterator contactNodeIt)
ShapeContactNode::NodeExistancePolicy existancePolicy
NodeConstIterator contactNodeIt