AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ElementaryContactPoint.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
20
21namespace agx
22{
25
42 {
43 public:
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:
183
185
186 protected:
195 };
196
198 {
199 return m_cmOffset1;
200 }
201
203 {
204 return m_cmOffset2;
205 }
206
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
259
260 public:
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}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
A contact point in a contact data.
Definition Contacts.h:56
This class store the combine material properties between two agx::Material's.
Definition Material.h:516
Elementary constraint base class with interface and global constraint functionality.
Interface factory for custom contact point constraint implementations.
void end()
Flag that the constraint won't call 'get' anymore.
void increaseCache(size_t size)
Increases the cache with the given size.
virtual ElementaryContactPoint * createInstance()=0
Create a new instance when the requested index exceeds the size of the cache.
void reset()
Reset the cache counter.
size_t begin()
Begin using 'get' given local index.
ElementaryContactPoint * get(size_t localIndex)
Returns an instance at the given index in the cache, e.g., this method can be used as (in a constrain...
const ElementaryContactPointRefVector & getCache() const
Base class of custom implementations of contact point constraints.
virtual void configure(agxCollide::ContactPoint &contactPoint, const InputData &inputData)=0
Configure the contact point constraint given contact point and geometry contact related data.
ElementaryContactPoint(UInt numRows)
Construct given total number of rows per contact point.
Real calculateImpactSpeed(Real restitution, Vec3f direction, const InputData &inputData) const
Calculates the impact speed > 0 along the a given direction.
virtual void renderDebug() const
Render debug things using agxRender::RenderSingleton.
virtual UInt getBounds(RangeReal *bounds, UInt row, Real h) const override
Writes m_normalForceRange of the contact point at row 0 by default and setting all other rows to [-0,...
virtual void initialize(agxCollide::ContactPoint &contactPoint, const InputData &inputData) final
Initializes some convenient data and calls 'configure' which is the implementation dependent initiali...
virtual void onPostSolve(agxCollide::ContactPoint &contactPoint, const Real *solution, Real h) const =0
Callback when the solver is done.
virtual UInt getViolation(Real *g, UInt row) override
Writes the contact point violation at row 0 by default.
virtual Bool isImpacting() const override
Impacting if the velocity at row 0 is larger than zero.
virtual UInt getVelocity(Real *v, UInt row) const override
Writes the local m_velocity buffer to the solver.
Real calculateNormalImpactSpeed(const agxCollide::ContactPoint &contactPoint, const InputData &inputData) const
Calculates the impact speed > 0 along the normal of the given contact point.
static Real calculateNormalEpsilonAsCompliance(const agxCollide::ContactPoint &contactPoint, const InputData &inputData)
Material properties of the normal using utility functions used in the solver.
Base class providing referencing counted objects.
Definition Referenced.h:120
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition Integer.h:40
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
std::valarray< agx::Real > RealValarray
For this module, vectors are defined using valarray.
Input data of the geometry contact, which is constant for all contact points.
Real impactCondition
Minimum speed >= 0 that can generate an impact.
const ConstraintImplementation::SolverBodyView bodies
Bodies in the geometry contact.
const ContactMaterial & contactMaterial
Contact material in the geometry contact.