AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
CapsuleEntity.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. 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
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid 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
18// AUTOMATICALLY GENERATED ENTITY, DO NOT EDIT! //
20
21#ifndef GENERATED_AGX_PHYSICS_GEOMETRY_CAPSULE_H_PLUGIN
22#define GENERATED_AGX_PHYSICS_GEOMETRY_CAPSULE_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>
41#include <agxData/EntityRef.h>
42#include <agxData/EntityPtr.h>
44#include <agx/Integer.h>
45#include <agx/Real.h>
46#include <agx/macros.h>
48#include <agx/Real.h>
49
50
51namespace agx
52{
53 namespace Physics
54 {
55 namespace Geometry
56 {
57
58 class CapsuleModel;
59 class CapsuleData;
60 class CapsulePtr;
61 class CapsuleInstance;
62 class CapsuleSemantics;
63
64
66
71 {
72 public:
74
75 CapsuleModel(const agx::String& name = "Capsule");
76
79
82
85
87 virtual void shutdownCleanup() override;
88
89
90
91 /* Attributes */
94
95 protected:
96 virtual ~CapsuleModel();
97 virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
98 virtual void configure(agx::TiXmlElement* eEntity) override;
99 virtual void initAttributeAccessors() override;
100 virtual void construct(agxData::EntityPtr instance) override;
102 };
103
104
106 #ifndef AGX_PHYSICS_GEOMETRY_CAPSULE_DATA_SET_OVERRIDE
107 #define AGX_PHYSICS_GEOMETRY_CAPSULE_DATA_SET
108 class AGXPHYSICS_EXPORT CapsuleData : public agx::Physics::Geometry::ShapeData
109 {
110 public:
111 CapsuleInstance operator[] (size_t index);
112
113 public:
117
118 public:
119 typedef agx::Real heightType;
120 typedef agx::Real radiusType;
121
122 public:
123 CapsuleData(agxData::EntityStorage* storage);
124 CapsuleData();
125
126 protected:
127 virtual ~CapsuleData() {}
128 virtual void setNumElements(agx::Index numElements) override;
129
130 private:
131 CapsuleData& operator= (const CapsuleData&) { return *this; }
132
133 };
134 #endif
136
137
139 class AGXPHYSICS_EXPORT CapsuleSemantics : public agx::Physics::Geometry::ShapeSemantics
140 {
141 public:
142
143 // Automatic getters
144 agx::Real const& getHeight() const;
145 agx::Real const& getRadius() const;
146
147 // Semantics defined by explicit kernels
148
149 // Automatic setters
150 void setHeight(agx::Real const& value);
151 void setRadius(agx::Real const& value);
152
153
154 protected:
155 friend class CapsulePtr;
156 friend class CapsuleInstance;
157 CapsuleSemantics();
158 };
160
161
162
165 class CALLABLE CapsulePtr : public agx::Physics::Geometry::ShapePtr
166 {
167 public:
169 typedef CapsuleData DataType;
170 typedef CapsuleInstance InstanceType;
171
172 public:
179 AGXPHYSICS_EXPORT CapsuleInstance instance();
180 AGXPHYSICS_EXPORT const CapsuleInstance instance() const;
181
182 AGXPHYSICS_EXPORT CapsuleSemantics* operator->();
183 AGXPHYSICS_EXPORT const CapsuleSemantics* operator->() const;
184
185 CapsuleData* getData();
186 const CapsuleData* getData() const;
187
188
193
198
199 };
200
201 // Entity is Referenced
203
204
206 class AGXPHYSICS_EXPORT CapsuleInstance : public agx::Physics::Geometry::ShapeInstance
207 {
208 public:
209 CapsuleInstance();
210 CapsuleInstance(CapsuleData* data, agx::Index index);
211 CapsuleInstance(agxData::EntityStorage *storage, agx::Index index);
212 CapsuleInstance(const agxData::EntityInstance& other);
213 CapsuleInstance(const agxData::EntityPtr& ptr);
214
215 CapsuleData* getData();
216 const CapsuleData* getData() const;
217
218 public:
220 agx::Real& height();
222 agx::Real const& height() const;
223
225 agx::Real& radius();
227 agx::Real const& radius() const;
228
229 };
231
232
233
236
237
238
240 /* Implementation */
241 //-----------------------------------------------------------------------------------------------------
242 //-----------------------------------------------------------------------------------------------------
243 inline CapsuleInstance agx::Physics::Geometry::CapsuleData::operator[] (size_t index) { return CapsuleInstance(this, (agx::Index)index); }
244 //-----------------------------------------------------------------------------------------------------
246 AGX_FORCE_INLINE CapsulePtr::CapsulePtr(agxData::EntityStorage* storage, agx::Index id) : agx::Physics::Geometry::ShapePtr(storage, id) {}
247 AGX_FORCE_INLINE CapsulePtr::CapsulePtr(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapePtr(ptr)
248 {
250 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
251 EntityPtr::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
252 }
253
254 AGX_FORCE_INLINE CapsulePtr::CapsulePtr(const agxData::EntityInstance& instance) : agx::Physics::Geometry::ShapePtr(instance)
255 {
256 agxAssertN(!instance || instance.isInstanceOf(CapsuleModel::instance()),
257 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
258 EntityPtr::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
259 }
260
261 AGX_FORCE_INLINE CapsulePtr& CapsulePtr::operator= (const agxData::EntityPtr& ptr)
262 {
264 agxAssertN(!ptr || ptr.isInstanceOf(CapsuleModel::instance()),
265 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
266 EntityPtr::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
267 return *this;
268 }
269
270 AGX_FORCE_INLINE CapsulePtr& CapsulePtr::operator= (const agxData::EntityInstance& instance)
271 {
273 agxAssertN(!instance || instance.isInstanceOf(CapsuleModel::instance()),
274 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
275 EntityPtr::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
276 return *this;
277 }
278
279 inline CapsuleInstance CapsulePtr::instance() { return agxData::EntityPtr::instance(); }
280 inline const CapsuleInstance CapsulePtr::instance() const { return agxData::EntityPtr::instance(); }
281 AGX_FORCE_INLINE CapsuleSemantics* CapsulePtr::operator->() { return (CapsuleSemantics* )this; }
282 AGX_FORCE_INLINE const CapsuleSemantics* CapsulePtr::operator->() const { return (const CapsuleSemantics* )this; }
283 AGX_FORCE_INLINE CapsuleData* CapsulePtr::getData() { return static_cast<CapsuleData* >(agxData::EntityPtr::getData()); }
284 AGX_FORCE_INLINE const CapsuleData* CapsulePtr::getData() const { return static_cast<const CapsuleData* >(agxData::EntityPtr::getData()); }
285
286 AGX_FORCE_INLINE agx::Real& CapsulePtr::height() { verifyIndex(); return getData()->height[calculateIndex()]; }
287 AGX_FORCE_INLINE agx::Real const& CapsulePtr::height() const { verifyIndex(); return getData()->height[calculateIndex()]; }
288
289 AGX_FORCE_INLINE agx::Real& CapsulePtr::radius() { verifyIndex(); return getData()->radius[calculateIndex()]; }
290 AGX_FORCE_INLINE agx::Real const& CapsulePtr::radius() const { verifyIndex(); return getData()->radius[calculateIndex()]; }
291
292 //-----------------------------------------------------------------------------------------------------
293 AGX_FORCE_INLINE CapsuleInstance::CapsuleInstance() {}
294 AGX_FORCE_INLINE CapsuleInstance::CapsuleInstance(CapsuleData* data, agx::Index index) : agx::Physics::Geometry::ShapeInstance(data, index) {}
295 AGX_FORCE_INLINE CapsuleInstance::CapsuleInstance(agxData::EntityStorage* storage, agx::Index index) : agx::Physics::Geometry::ShapeInstance(storage, index) {}
296 AGX_FORCE_INLINE CapsuleInstance::CapsuleInstance(const agxData::EntityInstance& other) : agx::Physics::Geometry::ShapeInstance(other)
297 {
299 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
300 EntityInstance::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
301 }
302
303 AGX_FORCE_INLINE CapsuleInstance::CapsuleInstance(const agxData::EntityPtr& ptr) : agx::Physics::Geometry::ShapeInstance(ptr)
304 {
306 "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
307 EntityInstance::getModel()->fullPath().c_str(), CapsuleModel::instance()->fullPath().c_str());
308 }
309
310
311 AGX_FORCE_INLINE CapsuleData* CapsuleInstance::getData() { return static_cast<CapsuleData* >(agxData::EntityInstance::getData()); }
312 AGX_FORCE_INLINE const CapsuleData* CapsuleInstance::getData() const { return static_cast<const CapsuleData* >(agxData::EntityInstance::getData()); }
313
314 AGX_FORCE_INLINE agx::Real& CapsuleInstance::height() { verifyIndex(); return getData()->height[getIndex()]; }
315 AGX_FORCE_INLINE agx::Real const& CapsuleInstance::height() const { verifyIndex(); return getData()->height[getIndex()]; }
316
317 AGX_FORCE_INLINE agx::Real& CapsuleInstance::radius() { verifyIndex(); return getData()->radius[getIndex()]; }
318 AGX_FORCE_INLINE agx::Real const& CapsuleInstance::radius() const { verifyIndex(); return getData()->radius[getIndex()]; }
319
320 //-----------------------------------------------------------------------------------------------------
321 AGX_FORCE_INLINE CapsuleSemantics::CapsuleSemantics() {}
322 //-----------------------------------------------------------------------------------------------------
324 }
325 }
326}
327
328AGX_TYPE_BINDING(agx::Physics::Geometry::CapsulePtr, "Physics.Geometry.CapsulePtr")
329AGX_TYPE_BINDING(agx::Physics::Geometry::CapsuleInstance, "Physics.Geometry.CapsuleInstance")
330
331#ifdef _MSC_VER
332# pragma warning(pop)
333#endif
334
335#undef AGX_ENTITY_WRAPPER
336#undef AGX_ENTITY_NAMESPACE
337#endif
338
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#define AGX_TYPE_BINDING(_Type, _Name)
Definition: Type.h:179
#define AGXPHYSICS_EXPORT
Type-specific Array used for fast access into the data held by a Buffer.
Definition: Array.h:107
Entity instance provides access to a single instance in an EntityStorage.
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
EntityPtr & operator=(const EntityPtr &other)=default
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
An entity reference is a safe/referencing handle to an entity instance whose model is descendant from...
Definition: EntityRef.h:35
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:73
agx::String fullPath() const
Abstract description of the data attributes for the Physics.Geometry.Capsule entity.
Definition: CapsuleEntity.h:71
virtual void construct(agxData::EntityPtr instance) override
void construct(agx::Physics::Geometry::CapsulePtr capsule)
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::Real > * heightAttribute
Definition: CapsuleEntity.h:92
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
virtual void configure(agx::TiXmlElement *eEntity) override
static CapsuleModel * instance()
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
CapsuleModel(const agx::String &name="Capsule")
static CapsulePtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
static agxData::ScalarAttributeT< agx::Real > * radiusAttribute
Definition: CapsuleEntity.h:93
virtual void initAttributeAccessors() override
Pointer to a entity instance of type Physics.Geometry.Capsule.
AGXPHYSICS_EXPORT agx::Real & radius()
AGXPHYSICS_EXPORT agx::Real & height()
AGXPHYSICS_EXPORT const CapsuleSemantics * operator->() const
AGXPHYSICS_EXPORT CapsuleSemantics * operator->()
AGXPHYSICS_EXPORT agx::Real const & height() const
AGXPHYSICS_EXPORT agx::Real const & radius() const
AGXPHYSICS_EXPORT CapsulePtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT CapsulePtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT const CapsuleInstance instance() const
AGXPHYSICS_EXPORT CapsulePtr(const agxData::EntityPtr &ptr)
const CapsuleData * getData() const
AGXPHYSICS_EXPORT CapsuleInstance instance()
Abstract description of the data attributes for the Physics.Geometry.Shape entity.
Definition: ShapeEntity.h:76
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:196
Vector containing 'raw' data.
Definition: agx/Vector.h:246
#define agxAssertN(expr, format,...)
Definition: debug.h:145
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxData::EntityRef< CapsulePtr > CapsuleRef
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41
UInt32 Index
Definition: Integer.h:44