AGX Dynamics  2.37.2.0
OrientedGeometryBoundEntity.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
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a 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 
18 // AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20 
21 #ifndef GENERATED_AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_H_PLUGIN
23 
24 #define AGX_ENTITY_WRAPPER 1
25 
26 
27 #ifdef _MSC_VER
28 # pragma warning(push)
29 // warning C4505: 'agxData::VectorAttributeT<T>::print' : unreferenced local function has been removed
30 # pragma warning( disable : 4505 )
31 // warning C4251: 'X' : class 'Y' needs to have dll-interface to be used by clients of class 'Z'
32 # pragma warning( disable : 4251 )
33 // warning C4355: 'this' : used in base member initializer list
34 # pragma warning( disable : 4355 )
35 // marked as __forceinline not inlined
36 # pragma warning( disable: 4714 )
37 #endif
38 
39 #include <agxData/EntityModel.h>
40 #include <agxData/EntityStorage.h>
41 #include <agxData/EntityRef.h>
42 #include <agxData/EntityPtr.h>
43 #include <agxData/EntityInstance.h>
44 #include <agx/Integer.h>
45 #include <agx/Real.h>
46 #include <agx/macros.h>
48 #include <agx/Bound.h>
49 #include <agx/Vec3.h>
50 #include <agx/AffineMatrix4x4.h>
51 
52 namespace agx { namespace Physics { class GeometryPtr; }}
53 
54 namespace agx
55 {
56  namespace Physics
57  {
58  namespace HierarchicalGrid
59  {
60 
61  class OrientedGeometryBoundModel;
62  class OrientedGeometryBoundData;
63  class OrientedGeometryBoundPtr;
64  class OrientedGeometryBoundInstance;
65  class OrientedGeometryBoundSemantics;
66 
67 
69 
74  {
75  public:
77 
78  OrientedGeometryBoundModel(const agx::String& name = "OrientedGeometryBound");
79 
81  static OrientedGeometryBoundModel* instance();
82 
84  static OrientedGeometryBoundPtr createInstance();
85 
87  static agxData::EntityStorage* defaultStorage();
88 
90  virtual void shutdownCleanup() override;
91 
92 
93 
94  /* Attributes */
99 
100  protected:
101  virtual ~OrientedGeometryBoundModel();
102  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
103  virtual void configure(agx::TiXmlElement* eEntity) override;
104  virtual void initAttributeAccessors() override;
105  virtual void construct(agxData::EntityPtr instance) override;
106  void construct(agx::Physics::HierarchicalGrid::OrientedGeometryBoundPtr orientedGeometryBound);
107  };
108 
109 
111  #ifndef AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_DATA_SET_OVERRIDE
112  #define AGX_PHYSICS_HIERARCHICALGRID_ORIENTEDGEOMETRYBOUND_DATA_SET
113  class AGXPHYSICS_EXPORT OrientedGeometryBoundData : public agxData::EntityData
114  {
115  public:
116  OrientedGeometryBoundInstance operator[] (size_t index);
117 
118  public:
122  agxData::Array< agx::Vec3 > halfExtents;
124 
125  public:
126  typedef agx::Physics::GeometryPtr geometryType;
127  typedef agx::Bound3 localBoundType;
128  typedef agx::Vec3 halfExtentsType;
129  typedef agx::AffineMatrix4x4 invTransformType;
130 
131  public:
132  OrientedGeometryBoundData(agxData::EntityStorage* storage);
133  OrientedGeometryBoundData();
134 
135  protected:
136  virtual ~OrientedGeometryBoundData() {}
137  virtual void setNumElements(agx::Index numElements) override;
138 
139  private:
140  OrientedGeometryBoundData& operator= (const OrientedGeometryBoundData&) { return *this; }
141 
142  };
143  #endif
145 
146 
148  class AGXPHYSICS_EXPORT OrientedGeometryBoundSemantics : protected agxData::EntityPtr
149  {
150  public:
151 
152  // Automatic getters
153  agx::Physics::GeometryPtr const& getGeometry() const;
154  agx::Bound3 const& getLocalBound() const;
155  agx::Vec3 const& getHalfExtents() const;
156  agx::AffineMatrix4x4 const& getInvTransform() const;
157 
158  // Semantics defined by explicit kernels
159 
160  // Automatic setters
161  void setGeometry(agx::Physics::GeometryPtr const& value);
162  void setLocalBound(agx::Bound3 const& value);
163  void setHalfExtents(agx::Vec3 const& value);
164  void setInvTransform(agx::AffineMatrix4x4 const& value);
165 
166 
167  protected:
168  friend class OrientedGeometryBoundPtr;
169  friend class OrientedGeometryBoundInstance;
170  OrientedGeometryBoundSemantics();
171  };
173 
174 
175 
178  class CALLABLE OrientedGeometryBoundPtr : public agxData::EntityPtr
179  {
180  public:
182  typedef OrientedGeometryBoundData DataType;
183  typedef OrientedGeometryBoundInstance InstanceType;
184 
185  public:
192  AGXPHYSICS_EXPORT OrientedGeometryBoundInstance instance();
193  AGXPHYSICS_EXPORT const OrientedGeometryBoundInstance instance() const;
194 
195  AGXPHYSICS_EXPORT OrientedGeometryBoundSemantics* operator->();
196  AGXPHYSICS_EXPORT const OrientedGeometryBoundSemantics* operator->() const;
197 
198  OrientedGeometryBoundData* getData();
199  const OrientedGeometryBoundData* getData() const;
200 
201 
205  AGXPHYSICS_EXPORT agx::Physics::GeometryPtr const& geometry() const;
206 
208  AGXPHYSICS_EXPORT agx::Bound3& localBound();
210  AGXPHYSICS_EXPORT agx::Bound3 const& localBound() const;
211 
213  AGXPHYSICS_EXPORT agx::Vec3& halfExtents();
215  AGXPHYSICS_EXPORT agx::Vec3 const& halfExtents() const;
216 
218  AGXPHYSICS_EXPORT agx::AffineMatrix4x4& invTransform();
220  AGXPHYSICS_EXPORT agx::AffineMatrix4x4 const& invTransform() const;
221 
222  };
223 
224 
226  class AGXPHYSICS_EXPORT OrientedGeometryBoundInstance : public agxData::EntityInstance
227  {
228  public:
229  OrientedGeometryBoundInstance();
230  OrientedGeometryBoundInstance(OrientedGeometryBoundData* data, agx::Index index);
231  OrientedGeometryBoundInstance(agxData::EntityStorage *storage, agx::Index index);
232  OrientedGeometryBoundInstance(const agxData::EntityInstance& other);
233  OrientedGeometryBoundInstance(const agxData::EntityPtr& ptr);
234 
235  OrientedGeometryBoundData* getData();
236  const OrientedGeometryBoundData* getData() const;
237 
238  public:
240  agx::Physics::GeometryPtr& geometry();
242  agx::Physics::GeometryPtr const& geometry() const;
243 
245  agx::Bound3& localBound();
247  agx::Bound3 const& localBound() const;
248 
250  agx::Vec3& halfExtents();
252  agx::Vec3 const& halfExtents() const;
253 
255  agx::AffineMatrix4x4& invTransform();
257  agx::AffineMatrix4x4 const& invTransform() const;
258 
259  };
261 
262 
263 
266 
267 
268 
270  /* Implementation */
271  //-----------------------------------------------------------------------------------------------------
272  //-----------------------------------------------------------------------------------------------------
273  inline OrientedGeometryBoundInstance agx::Physics::HierarchicalGrid::OrientedGeometryBoundData::operator[] (size_t index) { return OrientedGeometryBoundInstance(this, (agx::Index)index); }
274  //-----------------------------------------------------------------------------------------------------
275  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr() {}
276  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr(agxData::EntityStorage* storage, agx::Index id) : agxData::EntityPtr(storage, id) {}
277  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
278  {
279  agxAssertN(!ptr || ptr.isInstanceOf(OrientedGeometryBoundModel::instance()),
280  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
281  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
282  }
283 
284  AGX_FORCE_INLINE OrientedGeometryBoundPtr::OrientedGeometryBoundPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
285  {
286  agxAssertN(!instance || instance.isInstanceOf(OrientedGeometryBoundModel::instance()),
287  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
288  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
289  }
290 
291  AGX_FORCE_INLINE OrientedGeometryBoundPtr& OrientedGeometryBoundPtr::operator= (const agxData::EntityPtr& ptr)
292  {
294  agxAssertN(!ptr || ptr.isInstanceOf(OrientedGeometryBoundModel::instance()),
295  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
296  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
297  return *this;
298  }
299 
300  AGX_FORCE_INLINE OrientedGeometryBoundPtr& OrientedGeometryBoundPtr::operator= (const agxData::EntityInstance& instance)
301  {
303  agxAssertN(!instance || instance.isInstanceOf(OrientedGeometryBoundModel::instance()),
304  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
305  EntityPtr::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
306  return *this;
307  }
308 
309  inline OrientedGeometryBoundInstance OrientedGeometryBoundPtr::instance() { return agxData::EntityPtr::instance(); }
310  inline const OrientedGeometryBoundInstance OrientedGeometryBoundPtr::instance() const { return agxData::EntityPtr::instance(); }
311  AGX_FORCE_INLINE OrientedGeometryBoundSemantics* OrientedGeometryBoundPtr::operator->() { return (OrientedGeometryBoundSemantics* )this; }
312  AGX_FORCE_INLINE const OrientedGeometryBoundSemantics* OrientedGeometryBoundPtr::operator->() const { return (const OrientedGeometryBoundSemantics* )this; }
313  AGX_FORCE_INLINE OrientedGeometryBoundData* OrientedGeometryBoundPtr::getData() { return static_cast<OrientedGeometryBoundData* >(agxData::EntityPtr::getData()); }
314  AGX_FORCE_INLINE const OrientedGeometryBoundData* OrientedGeometryBoundPtr::getData() const { return static_cast<const OrientedGeometryBoundData* >(agxData::EntityPtr::getData()); }
315 
316  AGX_FORCE_INLINE agx::Physics::GeometryPtr& OrientedGeometryBoundPtr::geometry() { verifyIndex(); return getData()->geometry[calculateIndex()]; }
317  AGX_FORCE_INLINE agx::Physics::GeometryPtr const& OrientedGeometryBoundPtr::geometry() const { verifyIndex(); return getData()->geometry[calculateIndex()]; }
318 
319  AGX_FORCE_INLINE agx::Bound3& OrientedGeometryBoundPtr::localBound() { verifyIndex(); return getData()->localBound[calculateIndex()]; }
320  AGX_FORCE_INLINE agx::Bound3 const& OrientedGeometryBoundPtr::localBound() const { verifyIndex(); return getData()->localBound[calculateIndex()]; }
321 
322  AGX_FORCE_INLINE agx::Vec3& OrientedGeometryBoundPtr::halfExtents() { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
323  AGX_FORCE_INLINE agx::Vec3 const& OrientedGeometryBoundPtr::halfExtents() const { verifyIndex(); return getData()->halfExtents[calculateIndex()]; }
324 
325  AGX_FORCE_INLINE agx::AffineMatrix4x4& OrientedGeometryBoundPtr::invTransform() { verifyIndex(); return getData()->invTransform[calculateIndex()]; }
326  AGX_FORCE_INLINE agx::AffineMatrix4x4 const& OrientedGeometryBoundPtr::invTransform() const { verifyIndex(); return getData()->invTransform[calculateIndex()]; }
327 
328  //-----------------------------------------------------------------------------------------------------
329  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance() {}
330  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(OrientedGeometryBoundData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
331  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
332  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
333  {
334  agxAssertN(!other || other.isInstanceOf(OrientedGeometryBoundModel::instance()),
335  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
336  EntityInstance::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
337  }
338 
339  AGX_FORCE_INLINE OrientedGeometryBoundInstance::OrientedGeometryBoundInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
340  {
341  agxAssertN(!ptr || ptr.isInstanceOf(OrientedGeometryBoundModel::instance()),
342  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
343  EntityInstance::getModel()->fullPath().c_str(), OrientedGeometryBoundModel::instance()->fullPath().c_str());
344  }
345 
346 
347  AGX_FORCE_INLINE OrientedGeometryBoundData* OrientedGeometryBoundInstance::getData() { return static_cast<OrientedGeometryBoundData* >(agxData::EntityInstance::getData()); }
348  AGX_FORCE_INLINE const OrientedGeometryBoundData* OrientedGeometryBoundInstance::getData() const { return static_cast<const OrientedGeometryBoundData* >(agxData::EntityInstance::getData()); }
349 
350  AGX_FORCE_INLINE agx::Physics::GeometryPtr& OrientedGeometryBoundInstance::geometry() { verifyIndex(); return getData()->geometry[getIndex()]; }
351  AGX_FORCE_INLINE agx::Physics::GeometryPtr const& OrientedGeometryBoundInstance::geometry() const { verifyIndex(); return getData()->geometry[getIndex()]; }
352 
353  AGX_FORCE_INLINE agx::Bound3& OrientedGeometryBoundInstance::localBound() { verifyIndex(); return getData()->localBound[getIndex()]; }
354  AGX_FORCE_INLINE agx::Bound3 const& OrientedGeometryBoundInstance::localBound() const { verifyIndex(); return getData()->localBound[getIndex()]; }
355 
356  AGX_FORCE_INLINE agx::Vec3& OrientedGeometryBoundInstance::halfExtents() { verifyIndex(); return getData()->halfExtents[getIndex()]; }
357  AGX_FORCE_INLINE agx::Vec3 const& OrientedGeometryBoundInstance::halfExtents() const { verifyIndex(); return getData()->halfExtents[getIndex()]; }
358 
359  AGX_FORCE_INLINE agx::AffineMatrix4x4& OrientedGeometryBoundInstance::invTransform() { verifyIndex(); return getData()->invTransform[getIndex()]; }
360  AGX_FORCE_INLINE agx::AffineMatrix4x4 const& OrientedGeometryBoundInstance::invTransform() const { verifyIndex(); return getData()->invTransform[getIndex()]; }
361 
362  //-----------------------------------------------------------------------------------------------------
363  AGX_FORCE_INLINE OrientedGeometryBoundSemantics::OrientedGeometryBoundSemantics() {}
364  //-----------------------------------------------------------------------------------------------------
366  }
367  }
368 }
369 
370 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::OrientedGeometryBoundPtr, "Physics.HierarchicalGrid.OrientedGeometryBoundPtr")
371 AGX_TYPE_BINDING(agx::Physics::HierarchicalGrid::OrientedGeometryBoundInstance, "Physics.HierarchicalGrid.OrientedGeometryBoundInstance")
372 
373 #ifdef _MSC_VER
374 # pragma warning(pop)
375 #endif
376 
377 #undef AGX_ENTITY_WRAPPER
378 #undef AGX_ENTITY_NAMESPACE
379 #endif
380 
agxData::EntityData * getData()
Abstract description of the data attributes for the Physics.HierarchicalGrid.OrientedGeometryBound en...
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
Pointer to a entity instance of type Physics.HierarchicalGrid.OrientedGeometryBound.
#define agxAssertN(expr, format,...)
Definition: debug.h:145
agxData::EntityData * getData()
agx::String fullPath() const
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:363
#define AGXPHYSICS_EXPORT
Entity instance provides access to a single instance in an EntityStorage.
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:51
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::AffineMatrix4x4 > * invTransformAttribute
#define AGX_FORCE_INLINE
Definition: Object.h:59
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
EntityPtr & operator=(const EntityPtr &other)=default
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Matrix class for rigid transformations (translation, rotation).
Pointer to a entity instance of type Physics.Geometry.
Contains classes for low level data storage for AGX.
Definition: Container.h:23
UInt32 Index
Definition: Integer.h:52
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:63
#define CALLABLE
Definition: Object.h:73
static agxData::ScalarAttributeT< agx::Bound3 > * localBoundAttribute
bool isInstanceOf(agxData::EntityModel *model) const
static agxData::ScalarAttributeT< agx::Vec3 > * halfExtentsAttribute
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
static agxData::ScalarAttributeT< agx::Physics::GeometryPtr > * geometryAttribute
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97