AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ShapeContactColliderUtils.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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 <agx/Referenced.h>
20#include <agx/Vec3.h>
23#include <agxCollide/Convex.h>
24#include <agxCollide/Sphere.h>
25#include <agxCollide/Line.h>
30
32
33
34namespace agxCollide
35{
36 class Shape;
37 class GeometryContactPtr;
38 class Geometry;
39}
40
41namespace agxSDK
42{
43 class Simulation;
44}
45
46
47namespace agxWire
48{
52 class AGXPHYSICS_EXPORT ShapeContactColliderUtils : public agx::Referenced
53 {
54 public:
55
59 ShapeContactColliderUtils();
60
65 agx::Bool replaceContactNodesWithShapeContacts(agxWire::Wire* wire) const;
66
67 static agx::Bool getLocalEdgeEnds(Node* node, agx::Vec3& edgeStart, agx::Vec3& edgeEnd);
68
69 static agx::Material* getMaterial(agxCollide::Shape* shape);
70 static agx::Vec3 getWorldEdgeNormal(Node* node);
71 static agxCollide::Geometry* getGeometry(Node* node);
72 static const agxCollide::Geometry* getGeometry(const Node* node);
73 static agx::Vec3 getWorldSurfaceNormal(Node* node);
74 static bool onSameGeometry(const Node* node, const Node* otherNode);
75 static agx::Real getEdgeVelocity(const Node* node);
76 static agx::Bool hasCylinderProperies(const agxCollide::Shape* shape);
77
82 static agx::Bool findCylinderSurfacePositionAndNormal(const agxCollide::Shape* shape, const agx::Vec3& nodeWp, agx::Vec3& cylCenterWorld, agx::Vec3& cylSurfaceVectorWorld, agx::Vec3& alongCylinderAxisVectorWorld);
83
84
85 agxWire::ShapeContactNode* createShapeContact(const agxWire::Wire* wire, agxCollide::Shape* shape, const agx::Vec3& wp) const;
86 agxWire::ShapeContactNode* convertToShapeContact(const agxWire::Wire* wire, agxWire::ContactNode* cn) const;
87 agx::Real calculateCornerAngle(ShapeContactEdge* edge, const agx::Real& wireRadius, const agx::Real& wirePrecision) const;
88 void generateSupportContact(agxSDK::Simulation* sim, ShapeContactNode* cn, agxCollide::Geometry* otherGeom) const;
89 agx::Bool getDeepestContact(const agx::Vec3& wirePos, const agx::Real& radius, const agxCollide::Shape* myShape, agx::Vec3& point, agx::Vec3& normal, agx::Real& depth) const;
90 agx::Bool collideSphereAndShape(const agx::Vec3 worldPos, const agx::Real sphereRadius, const agxCollide::Shape* shape, agxCollide::ShapeCollider::LocalContactPointVector& contactPoints) const;
91 agx::Bool collideWireSegmentAndShape(const agx::Real& radius, const agx::Vec3& sStart, const agx::Vec3& sEnd, const agxCollide::Shape* shape, agxCollide::ShapeCollider::LocalContactPointVector& contactPoints) const;
92 size_t collideLineAndShape(const agx::Vec3& sStart, const agx::Vec3& sEnd, const agxCollide::Shape* shape, agxCollide::ShapeCollider::LocalContactPointVector& contactPoints) const;
93 agx::Bool collideWithShape(const Node* node, const agxCollide::Shape* shape, const agx::Real& wireRadius) const;
94 agx::Bool collideEdgeParallelLinesNearShape(const ShapeContactEdge& edge, const agxCollide::Shape* shape, const agx::Real& allowedOverlap);
95 size_t handleStuckInsideOtherShape(const size_t numToReconsider, const agx::Vec3& edgeStart, const agx::Vec3& edgeCenter, const agx::Vec3 edgeEnd,const agxCollide::Shape* shape, agxCollide::ShapeCollider::LocalContactPointVector& contactPoints) const;
96 agx::Bool collectContactPointsForEdgeClamping(const ShapeContactEdge& edge, const agxCollide::Shape* shape, const agx::Real& allowedOverlap, agxCollide::ShapeCollider::LocalContactPointVector& contactPoints) const;
97
98 private:
99
100 agxWire::ShapeContactNode* createShapeContact(const agxWire::Wire* wire, agxCollide::Shape* shape, const agx::Vec3& wp,
101 const NodeConstIterator beforeNodeIterator, const NodeConstIterator afterNodeIterator,
102 const agx::Vec3& point, const agx::Vec3& normal, const agx::Real depth) const;
103 agxCollide::Convex* getPossibleSweepedConvex(ShapeContactNode* scn, const agx::Vec3 neighborPosition) const;
104 agxCollide::Sphere* getSphere(const agx::Real& radius) const;
105 agxCollide::Line* getLine(const agx::Vec3& sStart, const agx::Vec3& sEnd) const;
106 agxCollide::WireShape* getWireShape(const agx::Real& radius, const agx::Vec3& sStart, const agx::Vec3& sEnd, agx::AffineMatrix4x4& transform) const;
107
108 agxCollide::SphereRef m_sphere;
109 agxCollide::WireShapeRef m_wireSegment;
110 agxCollide::LineRef m_line;
111 };
112
113 typedef agx::ref_ptr<ShapeContactColliderUtils> ShapeContactColliderUtilsRef;
114}
115
#define AGXPHYSICS_EXPORT
A convex class for geometric intersection tests.
Definition Convex.h:37
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
A line shape for intersection tests, mostly for depth sensing and picking.
Base class for a shape.
Definition Shape.h:54
A sphere class for geometric intersection tests.
Definition Sphere.h:32
Internal class used by agxWire::Wire.
Definition WireShape.h:44
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition Simulation.h:126
Contact node class is a node that, currently, is defined to live on an edge on a geometry (agxCollide...
Interface and placeholder of controllers/helpers for wires.
Definition Wire.h:62
Main material class which acts as a holder of a Surface Material and a Bulk material.
Definition Material.h:376
Base class providing referencing counted objects.
Definition Referenced.h:120
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition Constraint.h:31
Implements a Wire model with adaptive resolution.
Definition MergedBody.h:40
bool Bool
Definition Integer.h:40
double Real
Definition Real.h:42