AGX Dynamics  2.35.0.1
GeometryContactMergeSplitThresholds.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 #pragma once
18 
20 
21 namespace agxSDK
22 {
24 
29  {
30  public:
35  {
36  MAX_RELATIVE_NORMAL_SPEED,
38  MAX_RELATIVE_TANGENT_SPEED,
40  MAX_ROLLING_SPEED,
42  NUM_MERGE_THRESHOLDS
43  };
44 
49  {
50  MAX_IMPACT_SPEED = NUM_MERGE_THRESHOLDS,
52  LOGICAL_IMPACT,
54  MAY_SPLIT_IN_GRAVITY_FIELD,
58  TANGENTIAL_ADHESION,
60  NORMAL_ADHESION,
62  NUM_THRESHOLDS
63  };
64 
65  public:
70 
76 
84  agx::Real getMaxRelativeNormalSpeed( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
85 
91 
99  agx::Real getMaxRelativeTangentSpeed( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
100 
106 
113  agx::Real getMaxRollingSpeed( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
114 
120 
129  agx::Real getMaxImpactSpeed( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
130 
137 
144  agx::Bool getSplitOnLogicalImpact( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
145 
152  void setMaySplitInGravityField( agx::Bool maySplitInGravityField );
153 
159  agx::Bool getMaySplitInGravityField( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
160 
167 
173  agx::Real getTangentialAdhesion( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
174 
181 
187  agx::Real getNormalAdhesion( const GeometryContactMergeSplitThresholds* other = nullptr ) const;
188 
189  public:
191 
195  virtual agx::ICloneableRef clone( agx::ICloneable* child = nullptr ) override;
196 
200  virtual void resetToDefault() override;
201 
202  protected:
207  };
208 
210  {
211  return get( MAX_RELATIVE_NORMAL_SPEED, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
212  }
213 
215  {
216  return get( MAX_RELATIVE_TANGENT_SPEED, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
217  }
218 
220  {
221  return get( MAX_ROLLING_SPEED, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
222  }
223 
225  {
226  return get( MAX_IMPACT_SPEED, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
227  }
228 
230  {
231  return get( LOGICAL_IMPACT, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } ) > agx::Real( 0.5 );
232  }
233 
235  {
236  return get( MAY_SPLIT_IN_GRAVITY_FIELD, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } ) > agx::Real( 0.5 );
237  }
238 
240  {
241  return get( TANGENTIAL_ADHESION, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
242  }
243 
245  {
246  return get( NORMAL_ADHESION, other, []( agx::Real a, agx::Real b ) -> agx::Real { return std::max( a, b ); } );
247  }
248 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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
Specific thresholds used to merge and split given geometry contacts.
virtual ~GeometryContactMergeSplitThresholds()
Reference counted object - protected destructor.
void setMaxRollingSpeed(agx::Real value)
Assign maximum (rolling) speed for a contact to be considered resting.
agx::Real getMaxRollingSpeed(const GeometryContactMergeSplitThresholds *other=nullptr) const
virtual void resetToDefault() override
Reset all values to default.
agx::Bool getMaySplitInGravityField(const GeometryContactMergeSplitThresholds *other=nullptr) const
agx::Real getMaxRelativeTangentSpeed(const GeometryContactMergeSplitThresholds *other=nullptr) const
SplitThresholds
Indices to the threshold values when a body should be split.
@ MAY_SPLIT_IN_GRAVITY_FIELD
Check split given external forces for all objects merged (i.e., rb->getForce() the sum of rb->addForc...
@ NORMAL_ADHESION
Adhesive force in the normal direction preventing the object to split (if > 0).
@ MAX_IMPACT_SPEED
If the impact speed (approaching each other) is higher than this value, the objects may split.
@ TANGENTIAL_ADHESION
Adhesive force in the tangential directions preventing the object to split (if > 0).
@ LOGICAL_IMPACT
Split when the state of the geometry contact is agxCollide::GeometryContact::IMPACT_STATE.
agx::Real getNormalAdhesion(const GeometryContactMergeSplitThresholds *other=nullptr) const
void setSplitOnLogicalImpact(agx::Bool value)
True to split when geometry contact state is agxCollide::GeometryContact::IMPACT_STATE,...
MergeThresholds
Indices to the threshold values when a body should be merged.
@ MAX_RELATIVE_TANGENT_SPEED
If the speed along a contact tangent is less than this value, the object may be merged.
@ MAX_ROLLING_SPEED
If the relative rolling speed is less than this the object may be merged.
@ MAX_RELATIVE_NORMAL_SPEED
If the speed along a contact normal is less than this value, the object may be merged.
agx::Real getMaxRelativeNormalSpeed(const GeometryContactMergeSplitThresholds *other=nullptr) const
void setTangentialAdhesion(agx::Real value)
Adhesive force in the tangential directions preventing the object to split (if > 0) when the object i...
agx::Real getMaxImpactSpeed(const GeometryContactMergeSplitThresholds *other=nullptr) const
void setMaxRelativeTangentSpeed(agx::Real value)
Assign maximum (sliding) speed along a contact tangent for a contact to be considered resting.
virtual agx::ICloneableRef clone(agx::ICloneable *child=nullptr) override
Creates and returns a clone of this object.
void setNormalAdhesion(agx::Real value)
Adhesive force in the normal directions preventing the object to split (if > 0) when the object is su...
agx::Bool getSplitOnLogicalImpact(const GeometryContactMergeSplitThresholds *other=nullptr) const
agx::Real getTangentialAdhesion(const GeometryContactMergeSplitThresholds *other=nullptr) const
GeometryContactMergeSplitThresholds()
Default constructor, all thresholds will be set to default.
void setMaxImpactSpeed(agx::Real value)
Assign maximum impact speed (along a contact normal) a merged object can resist without being split.
void setMaySplitInGravityField(agx::Bool maySplitInGravityField)
Check split given external forces for all objects merged (i.e., rb->getForce() the sum of rb->addForc...
void setMaxRelativeNormalSpeed(agx::Real value)
Assign maximum speed along a contact normal for a contact to be considered resting.
Base class for thresholds/constants/values used in agxSDK::MergeSplitAlgorithm.
agx::Real get(const agx::UInt index) const
Interface class for a cloneable reference counted object.
Definition: ICloneable.h:30
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
bool Bool
Definition: Integer.h:48
uint32_t UInt
Definition: Integer.h:34
double Real
Definition: Real.h:42
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:874