AGX Dynamics  2.37.3.2
DeformableMineFace.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 #ifndef AGXMODEL_DEFORMABLE_MINE_FACE_H
18 #define AGXMODEL_DEFORMABLE_MINE_FACE_H
19 
20 #include <agxModel/export.h>
21 
24 #include <agxData/Buffer.h>
25 
26 namespace agx
27 {
28  class Journal;
29 }
30 
31 namespace agxModel
32 {
33 
44  {
45  public:
46 
50  DeformableMineFace( agxCollide::HeightField* heightField, agxCollide::Shape* deformerShape );
51 
53  virtual void preCollide(const agx::TimeStamp& t) override;
54 
56  agx::Real getDeformedVolume() const;
57 
59  void resetDeformedVolume();
60 
62  agx::Real getDeepestDepthReached() const;
63 
65  void resetDeepestDepthReached();
66 
68  void setMinDeformableIndices(size_t x, size_t y);
69 
71  void setMaxDeformableIndices(size_t x, size_t y);
72 
74  agx::Vec2i getMinDeformableIndices() const;
75 
77  agx::Vec2i getMaxDeformableIndices() const;
78 
87  void deformHeightFieldFromGeometry( agxCollide::Geometry* geometry, bool recordDeformStats=true );
88 
93  const agx::RealVector& getVolumeDifferences() const;
94 
101  bool getConvexHullFromRemovedVolume( agx::Vec3Vector& convexHull ) const;
102 
106  agxCollide::Shape* getDeformerShape() const;
107 
112  void setForbiddenIndices( const agx::Vec2iVector& forbiddenIndices );
113 
119  void addForbiddenIndex( size_t x, size_t y );
120 
124  agx::Vector< agx::Vec2i > getForbiddenIndices() const;
125 
129  void clearForbiddenIndices();
130 
132 
133  protected:
134  virtual ~DeformableMineFace();
136 
137  void deformHeightFieldFromShape( agxCollide::Shape* shape,
138  bool recordDeformStats );
139 
140  bool isAllowedIndex( size_t x, size_t y ) const;
141 
142  protected:
151  };
152 
154 
155  // Implementations
156  AGX_FORCE_INLINE DeformableMineFace::~DeformableMineFace()
157  {
158  }
159 
160 
161  AGX_FORCE_INLINE agx::Real DeformableMineFace::getDeformedVolume() const
162  {
163  return m_deformedVolume;
164  }
165 
166 
167  AGX_FORCE_INLINE void DeformableMineFace::resetDeformedVolume()
168  {
169  m_deformedVolume = 0;
170  }
171 
172 
173  AGX_FORCE_INLINE agx::Real DeformableMineFace::getDeepestDepthReached() const
174  {
175  return m_deepestDepthReached;
176  }
177 
178 
179  AGX_FORCE_INLINE void DeformableMineFace::resetDeepestDepthReached()
180  {
181  m_deepestDepthReachedOffset += m_deepestDepthReached;
182  m_deepestDepthReached = 0;
183  }
184 
185 
186  AGX_FORCE_INLINE void DeformableMineFace::setMinDeformableIndices(size_t x, size_t y)
187  {
188  m_minDeformableIndices = agx::Vec2i(x,y);
189  }
190 
191 
192  AGX_FORCE_INLINE void DeformableMineFace::setMaxDeformableIndices(size_t x, size_t y)
193  {
194  m_maxDeformableIndices = agx::Vec2i(x, y);
195  }
196 
197 
198  AGX_FORCE_INLINE agx::Vec2i DeformableMineFace::getMinDeformableIndices() const
199  {
200  return m_minDeformableIndices;
201  }
202 
203 
204  AGX_FORCE_INLINE agx::Vec2i DeformableMineFace::getMaxDeformableIndices() const
205  {
206  return m_maxDeformableIndices;
207  }
208 
209  AGX_FORCE_INLINE const agx::RealVector& DeformableMineFace::getVolumeDifferences() const
210  {
211  return m_volumeDifferences;
212  }
213 
219  {
220  public:
230 
232  virtual void preCollide(const agx::TimeStamp&) override;
233 
237  agx::Real getTotalCreatedVolume() const;
238 
242  agx::Real getSummedUpDeformedVolume() const;
243 
249  void setSwellFactor(agx::Real swellFactor);
250 
255  agx::Real getSwellFactor() const;
256 
258  protected:
259  virtual ~DeformableParticleCreator();
260 
261  private:
264 
266  // Variables
268  protected:
276  };
277 }
278 
279 #endif
HeightFieldDeformer contains a agxCollide::HeightField.
agx::Physics::GranularBodySystemRef m_system
Derive from this class to implement a listener for simulation step events.
Base class for a shape.
Definition: Shape.h:53
DeformableMineFace contains a agxCollide::HeightField.
friend class DistributionTable
Definition: Emitter.h:388
Vec2T< Int > Vec2i
Definition: Vec2.h:40
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGX_FORCE_INLINE
Definition: Object.h:59
agx::Real TimeStamp
Definition: TimeStamp.h:26
agxCollide::ShapeRef m_deformerShape
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
agxModel::DeformableMineFaceRef m_deformableMineFace
uint32_t UInt
Definition: Integer.h:34
agx::ref_ptr< DistributionTable > DistributionTableRef
Definition: Emitter.h:56
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::SetVector< agx::Vec2i > m_forbiddenIndices
agx::ref_ptr< DeformableMineFace > DeformableMineFaceRef
#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 AGXMODEL_EXPORT
agx::ParticleEmitter::DistributionTableRef m_table
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
DeformableParticleCreator is a class used to generate granular material given the deformed volume in ...
A HeightField is a collision shape that can be created from a grid structure, like an image...