36 class WireContactEdge;
37 class WireContactPosition;
50 class WireGeometryController;
51 class WireContactController;
59 WireSensorController(WireGeometryController* geometryController, WireContactController* contactController);
64 void addNotification();
69 void removeNotification();
85 agxWire::WireGeometryController* getGeometryController()
const {
return m_geometryController; }
90 agxWire::WireContactController* getActiveContactController()
const {
return m_contactController; }
98 virtual ~WireSensorController() {}
108 class WireContactGeometryTransferController
111 WireContactGeometryTransferController(WireContactController *contactController);
112 ~WireContactGeometryTransferController() {}
117 WireContactController* getActiveContactController() {
return m_contactController; }
130 class ContactNodePlacementData
133 ContactNodePlacementData() : movingFromStartToEnd(false), openAngle(false), wireRadius(0), shortOffsetLength(0), triangleIndex(0), edgeIndex(0) {}
137 agx::Vec3 edgeStartRelativeMovementWorld;
140 bool movingFromStartToEnd;
144 size_t triangleIndex;
147 ~ContactNodePlacementData() {}
164 class AGXPHYSICS_EXPORT WireOldContactController :
public agxWire::WireContactController
167 WireOldContactController(Wire* wire);
169 static BodyFixedNode* changeToBodyFixed(ContactNode* contactNode, WireDistanceCompositeConstraint* wdcc);
174 virtual void preCollideUpdate();
175 virtual void preUpdate();
176 virtual void postUpdate();
180 WireContactGeometryTransferController* getContactGeometryTransferController() {
return m_contactGeometryTransferController; }
187 bool getIfStuckNode(Node* cln) {
return m_stuckNodes.contains(cln); }
188 bool getIfStuckNode(
const Node* cln)
const {
return m_stuckNodes.contains(
const_cast<Node*
>(cln)); }
189 bool getIfStuckWhereNextGeometryIsAvailable(Node* cln);
197 bool removeContact(WireDistanceCompositeConstraint* ldcc, ContactNode* cln);
198 WireSensorController* getSensorController()
const {
return m_sensorController; }
201 friend class WireContactGeometryTransferController;
202 friend class WireSensorController;
203 friend class WireImpactController;
204 virtual ~WireOldContactController();
214 ContactNodeCustomData(
bool passedEdgePassTest =
false) : m_passedEdgePassTest(passedEdgePassTest) {}
215 ContactNodeCustomData(
const agx::Vec3& worldDirTowardSurface,
const agx::Vec3& orgShapeEdgeStart,
const agx::Vec3& orgShapeEdgeEnd)
216 : m_passedEdgePassTest(false), m_dirTowardSurface(worldDirTowardSurface), m_orgShapeEdgeStart(orgShapeEdgeStart),
217 m_orgShapeEdgeEnd(orgShapeEdgeEnd) {}
219 bool m_passedEdgePassTest;
224 virtual ~ContactNodeCustomData() {}
231 class EdgeTransferController
234 EdgeTransferController(WireOldContactController* contactController);
235 ~EdgeTransferController() {}
251 bool getNeighboringBoxEdges(ContactNode* cln,
agx::Real tPos, WireContactEdgeVector& edges);
255 void chooseCorrectBoxEdge(ContactNode* cln,
agx::Real& tPos, WireContactEdgeVector& edges);
266 bool getNeighbourAlsoCircleFallOff(ContactNode* cln, Node* otherNode, WireContactEdgeVector& edges);
271 bool getNeighboringCylinderEdges(ContactNode* cln,
agx::Real tPos, WireContactEdgeVector& edges,
bool onCircle);
275 void chooseCorrectCylinderEdge(ContactNode* cln,
agx::Real& tPos, WireContactEdgeVector& edges,
bool onCircle);
292 agx::Real calculateMassForContact(WireDistanceCompositeConstraint* wdcc, Node* cln);
300 bool nodeFallsOffCylinderWithoutCircleEdges(
const ContactNode* cln);
301 bool areContactsOnNeighboringEdges(ContactNode* cln1, ContactNode* cln2);
302 bool checkIfPulledOffAlongEdge(ContactNode* cln,
const agx::Vec3 vPrev,
const agx::Vec3 vNext);
303 int validateContact(ContactNode* cln);
308 bool checkIfFuturePositionIsBad(Node* middleContact);
309 void fixFreeEndContactPassings(WireDistanceCompositeConstraint* ldcc);
311 void catchBadContactConfiguration(WireDistanceCompositeConstraint* ldcc,
agx::List<NodeIterator>& allContacts);
312 void moveEdgeContactNodes();
319 agx::Vec3& lineDirW,
agx::Real& lineLength,
size_t& triangleIndex,
size_t& edgeIndex,
bool& convexAngle,
322 void fixPenetrationProblems();
323 void fixMeshPenetrationProblems(
NodePtrContainer& meshContacts, WireDistanceCompositeConstraint* ldcc);
324 bool addBoxContactNearBoxContact(WireDistanceCompositeConstraint* ldcc, ContactNode* cln,
bool beforeNode);
325 void fixBoxPenetrationProblems(
NodePtrContainer& boxContacts, WireDistanceCompositeConstraint* ldcc);
326 void handleNewPossibleEdges();
330 void getWireAndEdgeInfo(ContactNode* cln,
agx::Real t,
agx::Vec3& oldWP,
agx::Vec3& newWP,
agx::Vec3& edgeStartW,
agx::Vec3& edgeEndW,
agx::Vec3& wireStartW,
agx::Vec3& wireEndW,
agx::Vec3& moveDirW,
agx::Vec3& offsetW,
agx::Vec3& edgeW,
agx::Vec3& edgeStart,
agx::Vec3& edgeEnd,
agx::Vec3& wireStart,
agx::Vec3& wireEnd,
agx::Vec3& moveDir,
agx::Vec3& offset,
agx::Vec3& edge,
agx::Real& wireRadius,
agx::Real& edgeLength);
335 agx::Vec3 contactBendForce(WireDistanceCompositeConstraint* ldcc, Node* node1, Node* node2, Node* node3,
agx::Vec3 edgeW);
337 void getData(
const agx::Vector<NodeIterator>& movableContactsOnOneMassless, WireDistanceCompositeConstraint* ldcc, BodyFixedNode* nextBfn,
342 void updateNormalForces(agxWire::WireDistanceCompositeConstraint* wireConstraint,
agx::List<NodeIterator>& contactNodeIterators);
344 bool moveEdgeContactNode(WireDistanceCompositeConstraint* ldcc, ContactNode* cln,
agx::Real maxLengthDifference,
bool updatePreviousPosition =
false,
bool ignoreFrictionAndMaxmovement =
false,
agx::Vec3 newShapePosition =
agx::Vec3(0, 0, 0));
347 void clearStuckNodes() { m_stuckNodes.clear(); }
349 void unStuck(ContactNode*cln);
350 void setStuckNode(ContactNode* cn);
351 void setIfStuckNode(Node* cln,
bool nextIsPossible) { m_stuckNodes.insert(cln, nextIsPossible); }
355 void removeSavedNewContactPosition(ContactNode* cln);
356 void clearContactsNewPosition() { m_contactToNewPosition.clear(); }
357 bool hasUsableNextGeometry(ContactNode* cln);
358 void removeContactsNearSourceDrain(WireDistanceCompositeConstraint* ldcc);
385 void addMeshInfoToContact(
const agxCollide::Mesh* meshShape, ContactNode* cln,
size_t triangleIndex,
size_t edgeIndex);
407 bool isOnSameEdge(
const ContactNode* cln1,
const ContactNode* cln2)
const;
414 int validateEdges(
const agx::AffineMatrix4x4& invShapeTransform,
const agx::Vec3& halfExtent,
const Node* geomBeginNode,
const Node* geomEndNode,
NodePtrContainer& newContacts, NodeRefNodePtrListIterRealVector& acceptedNodes)
const;
452 bool findNextTriangleAndEdge(
const ContactNode* cln,
const agxCollide::Mesh* meshShape,
const size_t triangleIndex,
const size_t vertexIndex,
const agx::Vec3& lineStartW,
const agx::Vec3& lineEndW,
agx::Vec3& edge1StartW,
agx::Vec3& edge1EndW,
size_t& tempNewTriangleIndex,
size_t& tempEdgeLocalIndex);
558 bool createAndInsertNode(
NodePtrContainer& newContacts,
size_t indexInAcceptedNodes, NodeRefNodePtrListIterRealVector& acceptedNodes,
const agxCollide::Geometry* geometry,
const agx::Vec3& worldWireGeomBeginPos,
const agx::Vec3& worldWireGeomEndPos,
const agx::Vec3& contactPoint,
const agx::Vec3& edgeStart,
const agx::Vec3& edgeEnd,
const agx::Vec3& edge,
const agx::Vec3& shapeEdgeOffset,
agx::Real closeThreshold)
const;
578 void removeLocalNode(
NodePtrContainer& newContacts, NodeRefNodePtrListIterRealVector& acceptedNodes,
size_t index)
const;
580 inline bool hasSavedNewContactPosition(ContactNode* cln)
582 return m_contactToNewPosition.contains(cln);
587 #if HASH_FOR_WIRE == HASH_NEW
590 #elif HASH_FOR_WIRE == HASH_OLD
598 WireContactGeometryTransferController* m_contactGeometryTransferController;
599 EdgeTransferController* m_edgeTransferController;
601 #if HASH_FOR_WIRE == HASH_NEW
603 #elif HASH_FOR_WIRE == HASH_OLD
609 ContactWireNodePtrContactPositionTable m_contactToNewPosition;