AGX Dynamics  2.35.0.1
CustomElementaryConstraints.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 #ifndef AGX_CUSTOMELEMENTARYCONSTRAINTS_H
18 #define AGX_CUSTOMELEMENTARYCONSTRAINTS_H
19 
21 
22 namespace agx
23 {
25  {
26  public:
28 
29  agx::ContactNormal* set( const agx::Vec3f& n, const agx::Vec3f& v1, const agx::Vec3f& v2, agx::Real c, agx::Real impactSpeed, agx::Real restitution, agx::Real impactCondition = agx::Real( -0.5 ), agx::Real adhesiveOverlap = agx::Real( 0 ) );
30 
32 
33  void setImpactSpeed( Real impactSpeed );
34 
36 
37  void setDepth( agx::Real c );
38 
40 
41  void setAdhesiveOverlap( agx::Real adhesiveOverlap );
42 
43  const agx::Vec3f& getV1() const;
44 
45  void setV1( const agx::Vec3f& v1 );
46 
47  const agx::Vec3f& getV2() const;
48 
49  void setV2( const agx::Vec3f& v2 );
50 
51  const agx::Vec3f& getN() const;
52 
53  void setN( const agx::Vec3f& n );
54 
56 
57  protected:
58  virtual ~ContactNormal();
59 
60  virtual agx::UInt getJacobian( agx::Jacobian6DOFElement* G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState ) override;
61  virtual agx::UInt getViolation( agx::Real* g, agx::UInt row ) override;
62 
63  protected:
70  };
71 
73 
75  {
76  public:
78 
79  agx::ContactTangent* set( const agx::Vec3f& dir, const agx::Vec3f& v1, const agx::Vec3f& v2, const agx::Vec3f& velocity );
80 
81  const agx::Vec3f& getDirection() const;
82 
83  const agx::Vec3f& getV1() const;
84 
85  const agx::Vec3f& getV2() const;
86 
88 
89  protected:
90  virtual ~ContactTangent();
91 
92  virtual agx::UInt getJacobian( agx::Jacobian6DOFElement* G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState ) override;
93  virtual agx::UInt getViolation( agx::Real* g, agx::UInt row ) override;
94  virtual agx::UInt getVelocity( agx::Real* v, agx::UInt row ) const override;
95 
96  protected:
101  };
102 
104 }
105 
106 #endif
#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
agx::Real getAdhesiveOverlap() const
agx::Real getImpactSpeed() const
agx::ContactNormal * set(const agx::Vec3f &n, const agx::Vec3f &v1, const agx::Vec3f &v2, agx::Real c, agx::Real impactSpeed, agx::Real restitution, agx::Real impactCondition=agx::Real(-0.5), agx::Real adhesiveOverlap=agx::Real(0))
void setV1(const agx::Vec3f &v1)
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
void setV2(const agx::Vec3f &v2)
const agx::Vec3f & getV2() const
virtual ~ContactNormal()
const agx::Vec3f & getV1() const
agx::Real getDepth() const
const agx::Vec3f & getN() const
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
void setImpactSpeed(Real impactSpeed)
void setAdhesiveOverlap(agx::Real adhesiveOverlap)
void setN(const agx::Vec3f &n)
void setDepth(agx::Real c)
virtual ~ContactTangent()
virtual agx::UInt getViolation(agx::Real *g, agx::UInt row) override
Returns the violation of this elementary constraint.
virtual agx::UInt getVelocity(agx::Real *v, agx::UInt row) const override
Returns the velocity of this elementary constraint (extra, driving term on the right hand side).
const agx::Vec3f & getV2() const
const agx::Vec3f & getDirection() const
const agx::Vec3f & getV1() const
virtual agx::UInt getJacobian(agx::Jacobian6DOFElement *G, agx::UInt numBlocks, agx::UInt row, agx::GWriteState::Enum writeState) override
Returns the Jacobian of this elementary constraint.
agx::ContactTangent * set(const agx::Vec3f &dir, const agx::Vec3f &v1, const agx::Vec3f &v2, const agx::Vec3f &velocity)
Helper class to hold data that is general for elementary constraints.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< ContactNormal > ContactNormalRef
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
agx::ref_ptr< ContactTangent > ContactTangentRef