AGX Dynamics  2.37.2.0
ElementaryContactPoint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 
20 
21 namespace agx
22 {
25 
42  {
43  public:
48  struct InputData
49  {
50  Real h;
55  InputData& operator = ( const InputData& ) = delete;
56  };
57 
58  public:
75  static Real calculateNormalEpsilonAsCompliance( const agxCollide::ContactPoint& contactPoint, const InputData& inputData );
76 
77  public:
86  Real calculateNormalImpactSpeed( const agxCollide::ContactPoint& contactPoint, const InputData& inputData ) const;
87 
97  Real calculateImpactSpeed( Real restitution, Vec3f direction, const InputData& inputData ) const;
98 
102  Vec3 getCmOffset1() const;
103 
107  Vec3 getCmOffset2() const;
108 
112  Vec3 getContactPointPosition() const;
113 
114  public:
119  virtual void initialize( agxCollide::ContactPoint& contactPoint, const InputData& inputData ) final;
120 
128  virtual void configure( agxCollide::ContactPoint& contactPoint, const InputData& inputData ) = 0;
129 
134  virtual void renderDebug() const;
135 
152  virtual void onPostSolve( agxCollide::ContactPoint& contactPoint, const Real* solution, Real h ) const = 0;
153 
157  virtual UInt getViolation( Real* g, UInt row ) override;
158 
163  virtual UInt getBounds( RangeReal* bounds, UInt row, Real h ) const override;
164 
168  virtual UInt getVelocity( Real* v, UInt row ) const override;
169 
173  virtual Bool isImpacting() const override;
174 
175  protected:
182  ElementaryContactPoint( UInt numRows );
183 
184  virtual ~ElementaryContactPoint();
185 
186  protected:
195  };
196 
198  {
199  return m_cmOffset1;
200  }
201 
203  {
204  return m_cmOffset2;
205  }
206 
208  {
209  return m_contactPointPosition;
210  }
211 
213 
221  {
222  public:
236  ElementaryContactPoint* get( size_t localIndex );
237 
243  size_t begin();
244 
248  void end();
249 
253  void reset();
254 
258  const ElementaryContactPointRefVector& getCache() const;
259 
260  public:
267  virtual ElementaryContactPoint* createInstance() = 0;
268 
269  protected:
274  void increaseCache( size_t size );
275 
276  protected:
279 
280  private:
282  size_t m_currentStartIndex;
283  size_t m_maxLocalIndex;
284  };
285 }
This class store the combine material properties between two agx::Material's.
Definition: Material.h:515
Elementary constraint base class with interface and global constraint functionality.
bool Bool
Definition: Integer.h:48
const ConstraintImplementation::SolverBodyView bodies
Bodies in the geometry contact.
agx::Real calculateImpactSpeed(const agx::Vec3 &point, const agx::Vec3f &normal, const agx::Vec3 &cmPos, const agx::Vec3 &linVel, const agx::Vec3 &angVel)
Calculates impact speed of one body given contact point and normal.
Input data of the geometry contact, which is constant for all contact points.
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Base class of custom implementations of contact point constraints.
Interface factory for custom contact point constraint implementations.
Real impactCondition
Minimum speed >= 0 that can generate an impact.
Base class providing referencing counted objects.
Definition: Referenced.h:119
uint32_t UInt
Definition: Integer.h:34
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
A contact point in a contact data.
Definition: Contacts.h:55
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
const ContactMaterial & contactMaterial
Contact material in the geometry contact.
double Real
Definition: Real.h:42