AGX Dynamics  2.35.0.1
ContactPointEntity.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
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_CONTACTPOINT_H_PLUGIN
22 #define GENERATED_AGX_PHYSICS_CONTACTPOINT_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>
47 #include <agx/Vec3.h>
48 #include <agx/Real.h>
49 #include <agx/Integer.h>
50 #include <agx/Vec4.h>
52 
53 namespace agx { namespace Physics { namespace Geometry { class ShapePtr; }}}
54 namespace agx { namespace Physics { namespace Geometry { class ShapePtr; }}}
55 
56 namespace agx
57 {
58  namespace Physics
59  {
60 
61  class ContactPointModel;
62  class ContactPointData;
63  class ContactPointPtr;
64  class ContactPointInstance;
65  class ContactPointSemantics;
66 
67 
69 
74  {
75  public:
77 
78  ContactPointModel(const agx::String& name = "ContactPoint");
79 
82 
85 
88 
90  virtual void shutdownCleanup() override;
91 
92 
93 
94  /* Attributes */
115 
116  protected:
118  virtual agxData::EntityData* createData(agxData::EntityStorage* storage) override;
119  virtual void configure(agx::TiXmlElement* eEntity) override;
120  virtual void initAttributeAccessors() override;
121  virtual void construct(agxData::EntityPtr instance) override;
123  };
124 
125 
127  #ifndef AGX_PHYSICS_CONTACTPOINT_DATA_SET_OVERRIDE
128  #define AGX_PHYSICS_CONTACTPOINT_DATA_SET
129  class AGXPHYSICS_EXPORT ContactPointData : public agxData::EntityData
130  {
131  public:
132  ContactPointInstance operator[] (size_t index);
133 
134  public:
143  agxData::Array< agx::Vec3 > localForce;
145  agxData::Array< agx::Real > maxNormalForce;
149  agxData::Array< agx::UInt8 > faceFeature1;
150  agxData::Array< agx::UInt8 > faceFeature2;
154  agxData::Array< agx::Real > elasticRestLengthShape1;
155  agxData::Array< agx::Real > elasticRestLengthShape2;
156 
157  public:
158  typedef agx::Vec3 pointType;
159  typedef agx::Vec3f normalType;
160  typedef agx::Vec3f tangentUType;
161  typedef agx::Vec3f tangentVType;
162  typedef agx::Real depthType;
163  typedef agx::UInt8 stateType;
164  typedef agx::Vec3f velocityType;
165  typedef agx::Vec3 localForceType;
166  typedef agx::Vec4i8 indexSetType;
167  typedef agx::Real maxNormalForceType;
168  typedef agx::Bool enabledType;
169  typedef agx::UInt32 faceIndex1Type;
170  typedef agx::UInt32 faceIndex2Type;
171  typedef agx::UInt8 faceFeature1Type;
172  typedef agx::UInt8 faceFeature2Type;
173  typedef agx::Physics::Geometry::ShapePtr shape1Type;
174  typedef agx::Physics::Geometry::ShapePtr shape2Type;
175  typedef agx::Real areaType;
176  typedef agx::Real elasticRestLengthShape1Type;
177  typedef agx::Real elasticRestLengthShape2Type;
178 
179  public:
180  ContactPointData(agxData::EntityStorage* storage);
181  ContactPointData();
182 
183  protected:
184  virtual ~ContactPointData() {}
185  virtual void setNumElements(agx::Index numElements) override;
186 
187  private:
188  ContactPointData& operator= (const ContactPointData&) { return *this; }
189 
190  };
191  #endif
193 
194 
196  class AGXPHYSICS_EXPORT ContactPointSemantics : protected agxData::EntityPtr
197  {
198  public:
199 
200  // Automatic getters
201  agx::Vec3 const& getPoint() const;
202  agx::Vec3f const& getNormal() const;
203  agx::Vec3f const& getTangentU() const;
204  agx::Vec3f const& getTangentV() const;
205  agx::Real const& getDepth() const;
206  agx::UInt8 const& getState() const;
207  agx::Vec3f const& getVelocity() const;
208  agx::Vec3 const& getLocalForce() const;
209  agx::Vec4i8 const& getIndexSet() const;
210  agx::Real const& getMaxNormalForce() const;
211  agx::Bool const& getEnabled() const;
212  agx::UInt32 const& getFaceIndex1() const;
213  agx::UInt32 const& getFaceIndex2() const;
214  agx::UInt8 const& getFaceFeature1() const;
215  agx::UInt8 const& getFaceFeature2() const;
216  agx::Physics::Geometry::ShapePtr const& getShape1() const;
217  agx::Physics::Geometry::ShapePtr const& getShape2() const;
218  agx::Real const& getArea() const;
219  agx::Real const& getElasticRestLengthShape1() const;
220  agx::Real const& getElasticRestLengthShape2() const;
221 
222  // Semantics defined by explicit kernels
223 
224  // Automatic setters
225  void setPoint(agx::Vec3 const& value);
226  void setNormal(agx::Vec3f const& value);
227  void setTangentU(agx::Vec3f const& value);
228  void setTangentV(agx::Vec3f const& value);
229  void setDepth(agx::Real const& value);
230  void setState(agx::UInt8 const& value);
231  void setVelocity(agx::Vec3f const& value);
232  void setLocalForce(agx::Vec3 const& value);
233  void setIndexSet(agx::Vec4i8 const& value);
234  void setMaxNormalForce(agx::Real const& value);
235  void setEnabled(agx::Bool const& value);
236  void setFaceIndex1(agx::UInt32 const& value);
237  void setFaceIndex2(agx::UInt32 const& value);
238  void setFaceFeature1(agx::UInt8 const& value);
239  void setFaceFeature2(agx::UInt8 const& value);
240  void setShape1(agx::Physics::Geometry::ShapePtr const& value);
241  void setShape2(agx::Physics::Geometry::ShapePtr const& value);
242  void setArea(agx::Real const& value);
243  void setElasticRestLengthShape1(agx::Real const& value);
244  void setElasticRestLengthShape2(agx::Real const& value);
245 
246 
247  protected:
248  friend class ContactPointPtr;
249  friend class ContactPointInstance;
250  ContactPointSemantics();
251  };
253 
254 
255 
258  class CALLABLE ContactPointPtr : public agxData::EntityPtr
259  {
260  public:
262  typedef ContactPointData DataType;
263  typedef ContactPointInstance InstanceType;
264 
265  public:
272  AGXPHYSICS_EXPORT ContactPointInstance instance();
273  AGXPHYSICS_EXPORT const ContactPointInstance instance() const;
274 
275  AGXPHYSICS_EXPORT ContactPointSemantics* operator->();
276  AGXPHYSICS_EXPORT const ContactPointSemantics* operator->() const;
277 
278  ContactPointData* getData();
279  const ContactPointData* getData() const;
280 
281 
286 
291 
296 
301 
306 
311 
316 
321 
326 
331 
336 
341 
346 
351 
356 
361 
366 
371 
376 
381 
383  // Only used by tolua!
384  #ifdef AGX_GENERATED_TOLUA_WRAPPER
385  inline agx::Vec3 const& getPoint() const { return (*this)->getPoint(); }
386  inline agx::Vec3f const& getNormal() const { return (*this)->getNormal(); }
387  inline agx::Vec3f const& getTangentU() const { return (*this)->getTangentU(); }
388  inline agx::Vec3f const& getTangentV() const { return (*this)->getTangentV(); }
389  inline agx::Real const& getDepth() const { return (*this)->getDepth(); }
390  inline agx::UInt8 const& getState() const { return (*this)->getState(); }
391  inline agx::Vec3f const& getVelocity() const { return (*this)->getVelocity(); }
392  inline agx::Vec3 const& getLocalForce() const { return (*this)->getLocalForce(); }
393  inline agx::Vec4i8 const& getIndexSet() const { return (*this)->getIndexSet(); }
394  inline agx::Real const& getMaxNormalForce() const { return (*this)->getMaxNormalForce(); }
395  inline agx::Bool const& getEnabled() const { return (*this)->getEnabled(); }
396  inline agx::UInt32 const& getFaceIndex1() const { return (*this)->getFaceIndex1(); }
397  inline agx::UInt32 const& getFaceIndex2() const { return (*this)->getFaceIndex2(); }
398  inline agx::UInt8 const& getFaceFeature1() const { return (*this)->getFaceFeature1(); }
399  inline agx::UInt8 const& getFaceFeature2() const { return (*this)->getFaceFeature2(); }
400  inline agx::Physics::Geometry::ShapePtr const& getShape1() const { return (*this)->getShape1(); }
401  inline agx::Physics::Geometry::ShapePtr const& getShape2() const { return (*this)->getShape2(); }
402  inline agx::Real const& getArea() const { return (*this)->getArea(); }
403  inline agx::Real const& getElasticRestLengthShape1() const { return (*this)->getElasticRestLengthShape1(); }
404  inline agx::Real const& getElasticRestLengthShape2() const { return (*this)->getElasticRestLengthShape2(); }
405 
406 
407  inline void setPoint(agx::Vec3 const& value) { (*this)->setPoint(value); }
408  inline void setNormal(agx::Vec3f const& value) { (*this)->setNormal(value); }
409  inline void setTangentU(agx::Vec3f const& value) { (*this)->setTangentU(value); }
410  inline void setTangentV(agx::Vec3f const& value) { (*this)->setTangentV(value); }
411  inline void setDepth(agx::Real const& value) { (*this)->setDepth(value); }
412  inline void setState(agx::UInt8 const& value) { (*this)->setState(value); }
413  inline void setVelocity(agx::Vec3f const& value) { (*this)->setVelocity(value); }
414  inline void setLocalForce(agx::Vec3 const& value) { (*this)->setLocalForce(value); }
415  inline void setIndexSet(agx::Vec4i8 const& value) { (*this)->setIndexSet(value); }
416  inline void setMaxNormalForce(agx::Real const& value) { (*this)->setMaxNormalForce(value); }
417  inline void setEnabled(agx::Bool const& value) { (*this)->setEnabled(value); }
418  inline void setFaceIndex1(agx::UInt32 const& value) { (*this)->setFaceIndex1(value); }
419  inline void setFaceIndex2(agx::UInt32 const& value) { (*this)->setFaceIndex2(value); }
420  inline void setFaceFeature1(agx::UInt8 const& value) { (*this)->setFaceFeature1(value); }
421  inline void setFaceFeature2(agx::UInt8 const& value) { (*this)->setFaceFeature2(value); }
422  inline void setShape1(agx::Physics::Geometry::ShapePtr const& value) { (*this)->setShape1(value); }
423  inline void setShape2(agx::Physics::Geometry::ShapePtr const& value) { (*this)->setShape2(value); }
424  inline void setArea(agx::Real const& value) { (*this)->setArea(value); }
425  inline void setElasticRestLengthShape1(agx::Real const& value) { (*this)->setElasticRestLengthShape1(value); }
426  inline void setElasticRestLengthShape2(agx::Real const& value) { (*this)->setElasticRestLengthShape2(value); }
427  #endif
429 
430  };
431 
432 
434  class AGXPHYSICS_EXPORT ContactPointInstance : public agxData::EntityInstance
435  {
436  public:
437  ContactPointInstance();
438  ContactPointInstance(ContactPointData* data, agx::Index index);
439  ContactPointInstance(agxData::EntityStorage *storage, agx::Index index);
440  ContactPointInstance(const agxData::EntityInstance& other);
441  ContactPointInstance(const agxData::EntityPtr& ptr);
442 
443  ContactPointData* getData();
444  const ContactPointData* getData() const;
445 
446  public:
448  agx::Vec3& point();
450  agx::Vec3 const& point() const;
451 
453  agx::Vec3f& normal();
455  agx::Vec3f const& normal() const;
456 
458  agx::Vec3f& tangentU();
460  agx::Vec3f const& tangentU() const;
461 
463  agx::Vec3f& tangentV();
465  agx::Vec3f const& tangentV() const;
466 
468  agx::Real& depth();
470  agx::Real const& depth() const;
471 
473  agx::UInt8& state();
475  agx::UInt8 const& state() const;
476 
478  agx::Vec3f& velocity();
480  agx::Vec3f const& velocity() const;
481 
483  agx::Vec3& localForce();
485  agx::Vec3 const& localForce() const;
486 
488  agx::Vec4i8& indexSet();
490  agx::Vec4i8 const& indexSet() const;
491 
493  agx::Real& maxNormalForce();
495  agx::Real const& maxNormalForce() const;
496 
498  agx::Bool& enabled();
500  agx::Bool const& enabled() const;
501 
503  agx::UInt32& faceIndex1();
505  agx::UInt32 const& faceIndex1() const;
506 
508  agx::UInt32& faceIndex2();
510  agx::UInt32 const& faceIndex2() const;
511 
513  agx::UInt8& faceFeature1();
515  agx::UInt8 const& faceFeature1() const;
516 
518  agx::UInt8& faceFeature2();
520  agx::UInt8 const& faceFeature2() const;
521 
525  agx::Physics::Geometry::ShapePtr const& shape1() const;
526 
530  agx::Physics::Geometry::ShapePtr const& shape2() const;
531 
533  agx::Real& area();
535  agx::Real const& area() const;
536 
538  agx::Real& elasticRestLengthShape1();
540  agx::Real const& elasticRestLengthShape1() const;
541 
543  agx::Real& elasticRestLengthShape2();
545  agx::Real const& elasticRestLengthShape2() const;
546 
547  };
549 
550 
551 
554 
555 
556 
558  /* Implementation */
559  //-----------------------------------------------------------------------------------------------------
560  //-----------------------------------------------------------------------------------------------------
561  inline ContactPointInstance agx::Physics::ContactPointData::operator[] (size_t index) { return ContactPointInstance(this, (agx::Index)index); }
562  //-----------------------------------------------------------------------------------------------------
565  AGX_FORCE_INLINE ContactPointPtr::ContactPointPtr(const agxData::EntityPtr& ptr) : agxData::EntityPtr(ptr)
566  {
568  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
570  }
571 
572  AGX_FORCE_INLINE ContactPointPtr::ContactPointPtr(const agxData::EntityInstance& instance) : agxData::EntityPtr(instance)
573  {
574  agxAssertN(!instance || instance.isInstanceOf(ContactPointModel::instance()),
575  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
577  }
578 
579  AGX_FORCE_INLINE ContactPointPtr& ContactPointPtr::operator= (const agxData::EntityPtr& ptr)
580  {
582  agxAssertN(!ptr || ptr.isInstanceOf(ContactPointModel::instance()),
583  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
584  EntityPtr::getModel()->fullPath().c_str(), ContactPointModel::instance()->fullPath().c_str());
585  return *this;
586  }
587 
588  AGX_FORCE_INLINE ContactPointPtr& ContactPointPtr::operator= (const agxData::EntityInstance& instance)
589  {
591  agxAssertN(!instance || instance.isInstanceOf(ContactPointModel::instance()),
592  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
593  EntityPtr::getModel()->fullPath().c_str(), ContactPointModel::instance()->fullPath().c_str());
594  return *this;
595  }
596 
597  inline ContactPointInstance ContactPointPtr::instance() { return agxData::EntityPtr::instance(); }
598  inline const ContactPointInstance ContactPointPtr::instance() const { return agxData::EntityPtr::instance(); }
599  AGX_FORCE_INLINE ContactPointSemantics* ContactPointPtr::operator->() { return (ContactPointSemantics* )this; }
600  AGX_FORCE_INLINE const ContactPointSemantics* ContactPointPtr::operator->() const { return (const ContactPointSemantics* )this; }
601  AGX_FORCE_INLINE ContactPointData* ContactPointPtr::getData() { return static_cast<ContactPointData* >(agxData::EntityPtr::getData()); }
602  AGX_FORCE_INLINE const ContactPointData* ContactPointPtr::getData() const { return static_cast<const ContactPointData* >(agxData::EntityPtr::getData()); }
603 
604  AGX_FORCE_INLINE agx::Vec3& ContactPointPtr::point() { verifyIndex(); return getData()->point[calculateIndex()]; }
605  AGX_FORCE_INLINE agx::Vec3 const& ContactPointPtr::point() const { verifyIndex(); return getData()->point[calculateIndex()]; }
606 
607  AGX_FORCE_INLINE agx::Vec3f& ContactPointPtr::normal() { verifyIndex(); return getData()->normal[calculateIndex()]; }
608  AGX_FORCE_INLINE agx::Vec3f const& ContactPointPtr::normal() const { verifyIndex(); return getData()->normal[calculateIndex()]; }
609 
610  AGX_FORCE_INLINE agx::Vec3f& ContactPointPtr::tangentU() { verifyIndex(); return getData()->tangentU[calculateIndex()]; }
611  AGX_FORCE_INLINE agx::Vec3f const& ContactPointPtr::tangentU() const { verifyIndex(); return getData()->tangentU[calculateIndex()]; }
612 
613  AGX_FORCE_INLINE agx::Vec3f& ContactPointPtr::tangentV() { verifyIndex(); return getData()->tangentV[calculateIndex()]; }
614  AGX_FORCE_INLINE agx::Vec3f const& ContactPointPtr::tangentV() const { verifyIndex(); return getData()->tangentV[calculateIndex()]; }
615 
616  AGX_FORCE_INLINE agx::Real& ContactPointPtr::depth() { verifyIndex(); return getData()->depth[calculateIndex()]; }
617  AGX_FORCE_INLINE agx::Real const& ContactPointPtr::depth() const { verifyIndex(); return getData()->depth[calculateIndex()]; }
618 
619  AGX_FORCE_INLINE agx::UInt8& ContactPointPtr::state() { verifyIndex(); return getData()->state[calculateIndex()]; }
620  AGX_FORCE_INLINE agx::UInt8 const& ContactPointPtr::state() const { verifyIndex(); return getData()->state[calculateIndex()]; }
621 
622  AGX_FORCE_INLINE agx::Vec3f& ContactPointPtr::velocity() { verifyIndex(); return getData()->velocity[calculateIndex()]; }
623  AGX_FORCE_INLINE agx::Vec3f const& ContactPointPtr::velocity() const { verifyIndex(); return getData()->velocity[calculateIndex()]; }
624 
625  AGX_FORCE_INLINE agx::Vec3& ContactPointPtr::localForce() { verifyIndex(); return getData()->localForce[calculateIndex()]; }
626  AGX_FORCE_INLINE agx::Vec3 const& ContactPointPtr::localForce() const { verifyIndex(); return getData()->localForce[calculateIndex()]; }
627 
628  AGX_FORCE_INLINE agx::Vec4i8& ContactPointPtr::indexSet() { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
629  AGX_FORCE_INLINE agx::Vec4i8 const& ContactPointPtr::indexSet() const { verifyIndex(); return getData()->indexSet[calculateIndex()]; }
630 
631  AGX_FORCE_INLINE agx::Real& ContactPointPtr::maxNormalForce() { verifyIndex(); return getData()->maxNormalForce[calculateIndex()]; }
632  AGX_FORCE_INLINE agx::Real const& ContactPointPtr::maxNormalForce() const { verifyIndex(); return getData()->maxNormalForce[calculateIndex()]; }
633 
634  AGX_FORCE_INLINE agx::Bool& ContactPointPtr::enabled() { verifyIndex(); return getData()->enabled[calculateIndex()]; }
635  AGX_FORCE_INLINE agx::Bool const& ContactPointPtr::enabled() const { verifyIndex(); return getData()->enabled[calculateIndex()]; }
636 
637  AGX_FORCE_INLINE agx::UInt32& ContactPointPtr::faceIndex1() { verifyIndex(); return getData()->faceIndex1[calculateIndex()]; }
638  AGX_FORCE_INLINE agx::UInt32 const& ContactPointPtr::faceIndex1() const { verifyIndex(); return getData()->faceIndex1[calculateIndex()]; }
639 
640  AGX_FORCE_INLINE agx::UInt32& ContactPointPtr::faceIndex2() { verifyIndex(); return getData()->faceIndex2[calculateIndex()]; }
641  AGX_FORCE_INLINE agx::UInt32 const& ContactPointPtr::faceIndex2() const { verifyIndex(); return getData()->faceIndex2[calculateIndex()]; }
642 
643  AGX_FORCE_INLINE agx::UInt8& ContactPointPtr::faceFeature1() { verifyIndex(); return getData()->faceFeature1[calculateIndex()]; }
644  AGX_FORCE_INLINE agx::UInt8 const& ContactPointPtr::faceFeature1() const { verifyIndex(); return getData()->faceFeature1[calculateIndex()]; }
645 
646  AGX_FORCE_INLINE agx::UInt8& ContactPointPtr::faceFeature2() { verifyIndex(); return getData()->faceFeature2[calculateIndex()]; }
647  AGX_FORCE_INLINE agx::UInt8 const& ContactPointPtr::faceFeature2() const { verifyIndex(); return getData()->faceFeature2[calculateIndex()]; }
648 
649  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr& ContactPointPtr::shape1() { verifyIndex(); return getData()->shape1[calculateIndex()]; }
650  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr const& ContactPointPtr::shape1() const { verifyIndex(); return getData()->shape1[calculateIndex()]; }
651 
652  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr& ContactPointPtr::shape2() { verifyIndex(); return getData()->shape2[calculateIndex()]; }
653  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr const& ContactPointPtr::shape2() const { verifyIndex(); return getData()->shape2[calculateIndex()]; }
654 
655  AGX_FORCE_INLINE agx::Real& ContactPointPtr::area() { verifyIndex(); return getData()->area[calculateIndex()]; }
656  AGX_FORCE_INLINE agx::Real const& ContactPointPtr::area() const { verifyIndex(); return getData()->area[calculateIndex()]; }
657 
658  AGX_FORCE_INLINE agx::Real& ContactPointPtr::elasticRestLengthShape1() { verifyIndex(); return getData()->elasticRestLengthShape1[calculateIndex()]; }
659  AGX_FORCE_INLINE agx::Real const& ContactPointPtr::elasticRestLengthShape1() const { verifyIndex(); return getData()->elasticRestLengthShape1[calculateIndex()]; }
660 
661  AGX_FORCE_INLINE agx::Real& ContactPointPtr::elasticRestLengthShape2() { verifyIndex(); return getData()->elasticRestLengthShape2[calculateIndex()]; }
662  AGX_FORCE_INLINE agx::Real const& ContactPointPtr::elasticRestLengthShape2() const { verifyIndex(); return getData()->elasticRestLengthShape2[calculateIndex()]; }
663 
664  //-----------------------------------------------------------------------------------------------------
665  AGX_FORCE_INLINE ContactPointInstance::ContactPointInstance() {}
666  AGX_FORCE_INLINE ContactPointInstance::ContactPointInstance(ContactPointData* data, agx::Index index) : agxData::EntityInstance(data, index) {}
667  AGX_FORCE_INLINE ContactPointInstance::ContactPointInstance(agxData::EntityStorage* storage, agx::Index index) : agxData::EntityInstance(storage, index) {}
668  AGX_FORCE_INLINE ContactPointInstance::ContactPointInstance(const agxData::EntityInstance& other) : agxData::EntityInstance(other)
669  {
671  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
673  }
674 
675  AGX_FORCE_INLINE ContactPointInstance::ContactPointInstance(const agxData::EntityPtr& ptr) : agxData::EntityInstance(ptr)
676  {
678  "Entity type mismatch. Storage contains entity data for type \'%s\', instance pointer is of type \'%s\'",
680  }
681 
682 
683  AGX_FORCE_INLINE ContactPointData* ContactPointInstance::getData() { return static_cast<ContactPointData* >(agxData::EntityInstance::getData()); }
684  AGX_FORCE_INLINE const ContactPointData* ContactPointInstance::getData() const { return static_cast<const ContactPointData* >(agxData::EntityInstance::getData()); }
685 
686  AGX_FORCE_INLINE agx::Vec3& ContactPointInstance::point() { verifyIndex(); return getData()->point[getIndex()]; }
687  AGX_FORCE_INLINE agx::Vec3 const& ContactPointInstance::point() const { verifyIndex(); return getData()->point[getIndex()]; }
688 
689  AGX_FORCE_INLINE agx::Vec3f& ContactPointInstance::normal() { verifyIndex(); return getData()->normal[getIndex()]; }
690  AGX_FORCE_INLINE agx::Vec3f const& ContactPointInstance::normal() const { verifyIndex(); return getData()->normal[getIndex()]; }
691 
692  AGX_FORCE_INLINE agx::Vec3f& ContactPointInstance::tangentU() { verifyIndex(); return getData()->tangentU[getIndex()]; }
693  AGX_FORCE_INLINE agx::Vec3f const& ContactPointInstance::tangentU() const { verifyIndex(); return getData()->tangentU[getIndex()]; }
694 
695  AGX_FORCE_INLINE agx::Vec3f& ContactPointInstance::tangentV() { verifyIndex(); return getData()->tangentV[getIndex()]; }
696  AGX_FORCE_INLINE agx::Vec3f const& ContactPointInstance::tangentV() const { verifyIndex(); return getData()->tangentV[getIndex()]; }
697 
698  AGX_FORCE_INLINE agx::Real& ContactPointInstance::depth() { verifyIndex(); return getData()->depth[getIndex()]; }
699  AGX_FORCE_INLINE agx::Real const& ContactPointInstance::depth() const { verifyIndex(); return getData()->depth[getIndex()]; }
700 
701  AGX_FORCE_INLINE agx::UInt8& ContactPointInstance::state() { verifyIndex(); return getData()->state[getIndex()]; }
702  AGX_FORCE_INLINE agx::UInt8 const& ContactPointInstance::state() const { verifyIndex(); return getData()->state[getIndex()]; }
703 
704  AGX_FORCE_INLINE agx::Vec3f& ContactPointInstance::velocity() { verifyIndex(); return getData()->velocity[getIndex()]; }
705  AGX_FORCE_INLINE agx::Vec3f const& ContactPointInstance::velocity() const { verifyIndex(); return getData()->velocity[getIndex()]; }
706 
707  AGX_FORCE_INLINE agx::Vec3& ContactPointInstance::localForce() { verifyIndex(); return getData()->localForce[getIndex()]; }
708  AGX_FORCE_INLINE agx::Vec3 const& ContactPointInstance::localForce() const { verifyIndex(); return getData()->localForce[getIndex()]; }
709 
710  AGX_FORCE_INLINE agx::Vec4i8& ContactPointInstance::indexSet() { verifyIndex(); return getData()->indexSet[getIndex()]; }
711  AGX_FORCE_INLINE agx::Vec4i8 const& ContactPointInstance::indexSet() const { verifyIndex(); return getData()->indexSet[getIndex()]; }
712 
713  AGX_FORCE_INLINE agx::Real& ContactPointInstance::maxNormalForce() { verifyIndex(); return getData()->maxNormalForce[getIndex()]; }
714  AGX_FORCE_INLINE agx::Real const& ContactPointInstance::maxNormalForce() const { verifyIndex(); return getData()->maxNormalForce[getIndex()]; }
715 
716  AGX_FORCE_INLINE agx::Bool& ContactPointInstance::enabled() { verifyIndex(); return getData()->enabled[getIndex()]; }
717  AGX_FORCE_INLINE agx::Bool const& ContactPointInstance::enabled() const { verifyIndex(); return getData()->enabled[getIndex()]; }
718 
719  AGX_FORCE_INLINE agx::UInt32& ContactPointInstance::faceIndex1() { verifyIndex(); return getData()->faceIndex1[getIndex()]; }
720  AGX_FORCE_INLINE agx::UInt32 const& ContactPointInstance::faceIndex1() const { verifyIndex(); return getData()->faceIndex1[getIndex()]; }
721 
722  AGX_FORCE_INLINE agx::UInt32& ContactPointInstance::faceIndex2() { verifyIndex(); return getData()->faceIndex2[getIndex()]; }
723  AGX_FORCE_INLINE agx::UInt32 const& ContactPointInstance::faceIndex2() const { verifyIndex(); return getData()->faceIndex2[getIndex()]; }
724 
725  AGX_FORCE_INLINE agx::UInt8& ContactPointInstance::faceFeature1() { verifyIndex(); return getData()->faceFeature1[getIndex()]; }
726  AGX_FORCE_INLINE agx::UInt8 const& ContactPointInstance::faceFeature1() const { verifyIndex(); return getData()->faceFeature1[getIndex()]; }
727 
728  AGX_FORCE_INLINE agx::UInt8& ContactPointInstance::faceFeature2() { verifyIndex(); return getData()->faceFeature2[getIndex()]; }
729  AGX_FORCE_INLINE agx::UInt8 const& ContactPointInstance::faceFeature2() const { verifyIndex(); return getData()->faceFeature2[getIndex()]; }
730 
731  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr& ContactPointInstance::shape1() { verifyIndex(); return getData()->shape1[getIndex()]; }
732  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr const& ContactPointInstance::shape1() const { verifyIndex(); return getData()->shape1[getIndex()]; }
733 
734  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr& ContactPointInstance::shape2() { verifyIndex(); return getData()->shape2[getIndex()]; }
735  AGX_FORCE_INLINE agx::Physics::Geometry::ShapePtr const& ContactPointInstance::shape2() const { verifyIndex(); return getData()->shape2[getIndex()]; }
736 
737  AGX_FORCE_INLINE agx::Real& ContactPointInstance::area() { verifyIndex(); return getData()->area[getIndex()]; }
738  AGX_FORCE_INLINE agx::Real const& ContactPointInstance::area() const { verifyIndex(); return getData()->area[getIndex()]; }
739 
740  AGX_FORCE_INLINE agx::Real& ContactPointInstance::elasticRestLengthShape1() { verifyIndex(); return getData()->elasticRestLengthShape1[getIndex()]; }
741  AGX_FORCE_INLINE agx::Real const& ContactPointInstance::elasticRestLengthShape1() const { verifyIndex(); return getData()->elasticRestLengthShape1[getIndex()]; }
742 
743  AGX_FORCE_INLINE agx::Real& ContactPointInstance::elasticRestLengthShape2() { verifyIndex(); return getData()->elasticRestLengthShape2[getIndex()]; }
744  AGX_FORCE_INLINE agx::Real const& ContactPointInstance::elasticRestLengthShape2() const { verifyIndex(); return getData()->elasticRestLengthShape2[getIndex()]; }
745 
746  //-----------------------------------------------------------------------------------------------------
747  AGX_FORCE_INLINE ContactPointSemantics::ContactPointSemantics() {}
748  //-----------------------------------------------------------------------------------------------------
750  }
751 }
752 
753 AGX_TYPE_BINDING(agx::Physics::ContactPointPtr, "Physics.ContactPointPtr")
754 AGX_TYPE_BINDING(agx::Physics::ContactPointInstance, "Physics.ContactPointInstance")
755 
756 #ifdef _MSC_VER
757 # pragma warning(pop)
758 #endif
759 
760 #undef AGX_ENTITY_WRAPPER
761 #undef AGX_ENTITY_NAMESPACE
762 #endif
763 
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#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()
An abstract description of a data entity stored using SOA (structure of arrays) pattern in a EntitySt...
Definition: EntityModel.h:64
Accessor to a entity instance stored in a EntityStorage, to allow SOA (structure of arrays) data to b...
Definition: EntityPtr.h:52
bool isInstanceOf(agxData::EntityModel *model) const
agxData::EntityData * getData()
agxData::EntityInstance instance()
Definition: EntityPtr.h:269
EntityPtr & operator=(const EntityPtr &other)=default
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.ContactPoint entity.
static agxData::ScalarAttributeT< agx::Physics::Geometry::ShapePtr > * shape2Attribute
static agxData::ScalarAttributeT< agx::Vec3f > * tangentUAttribute
ContactPointModel(const agx::String &name="ContactPoint")
virtual void shutdownCleanup() override
This is part of internal cleanup and should not be called by users.
static agxData::ScalarAttributeT< agx::UInt8 > * stateAttribute
static agxData::ScalarAttributeT< agx::Vec3f > * normalAttribute
static agxData::ScalarAttributeT< agx::UInt32 > * faceIndex1Attribute
virtual void initAttributeAccessors() override
static agxData::ScalarAttributeT< agx::Real > * depthAttribute
static agxData::ScalarAttributeT< agx::Vec3f > * tangentVAttribute
static agxData::ScalarAttributeT< agx::UInt32 > * faceIndex2Attribute
static agxData::ScalarAttributeT< agx::Physics::Geometry::ShapePtr > * shape1Attribute
virtual void configure(agx::TiXmlElement *eEntity) override
static agxData::ScalarAttributeT< agx::Vec3 > * pointAttribute
static ContactPointModel * instance()
static agxData::ScalarAttributeT< agx::UInt8 > * faceFeature2Attribute
static agxData::ScalarAttributeT< agx::Real > * elasticRestLengthShape1Attribute
static agxData::ScalarAttributeT< agx::Vec3f > * velocityAttribute
virtual agxData::EntityData * createData(agxData::EntityStorage *storage) override
static ContactPointPtr createInstance()
Create and return a pointer to a new instance in the default storage for this entity model.
virtual void construct(agxData::EntityPtr instance) override
static agxData::ScalarAttributeT< agx::Real > * maxNormalForceAttribute
static agxData::ScalarAttributeT< agx::Vec3 > * localForceAttribute
static agxData::ScalarAttributeT< agx::Vec4i8 > * indexSetAttribute
static agxData::EntityStorage * defaultStorage()
static agxData::ScalarAttributeT< agx::UInt8 > * faceFeature1Attribute
static agxData::ScalarAttributeT< agx::Real > * elasticRestLengthShape2Attribute
static agxData::ScalarAttributeT< agx::Bool > * enabledAttribute
void construct(agx::Physics::ContactPointPtr contactPoint)
static agxData::ScalarAttributeT< agx::Real > * areaAttribute
Pointer to a entity instance of type Physics.ContactPoint.
AGXPHYSICS_EXPORT agx::Vec3 const & point() const
AGXPHYSICS_EXPORT agx::Vec3f const & tangentV() const
AGXPHYSICS_EXPORT agx::Vec3f & normal()
AGXPHYSICS_EXPORT agx::UInt32 & faceIndex1()
The face index of shape 1 in contact (e.g. index of triangle for trimesh).
AGXPHYSICS_EXPORT agx::UInt8 const & faceFeature2() const
The face feature of shape 2 in contact (e.g. voronoi region on triangle for trimesh).
AGXPHYSICS_EXPORT agx::Vec3f & velocity()
AGXPHYSICS_EXPORT agx::Vec3f & tangentU()
AGXPHYSICS_EXPORT agx::UInt32 const & faceIndex2() const
The face index of shape 2 in contact (e.g. index of triangle for trimesh).
AGXPHYSICS_EXPORT ContactPointPtr(agxData::EntityStorage *storage, agx::Index id)
AGXPHYSICS_EXPORT agx::UInt8 const & faceFeature1() const
The face feature of shape 1 in contact (e.g. voronoi region on triangle for trimesh).
AGXPHYSICS_EXPORT agx::Real & elasticRestLengthShape1()
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr & shape2()
Shape number 2 in contact.
AGXPHYSICS_EXPORT ContactPointSemantics * operator->()
AGXPHYSICS_EXPORT agx::Vec3f const & normal() const
AGXPHYSICS_EXPORT agx::UInt32 & faceIndex2()
The face index of shape 2 in contact (e.g. index of triangle for trimesh).
AGXPHYSICS_EXPORT const ContactPointSemantics * operator->() const
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr & shape1()
Shape number 1 in contact.
AGXPHYSICS_EXPORT agx::Real const & elasticRestLengthShape2() const
AGXPHYSICS_EXPORT agx::Real & depth()
AGXPHYSICS_EXPORT agx::UInt32 const & faceIndex1() const
The face index of shape 1 in contact (e.g. index of triangle for trimesh).
AGXPHYSICS_EXPORT ContactPointPtr()
AGXPHYSICS_EXPORT agx::Real const & area() const
AGXPHYSICS_EXPORT ContactPointPtr(const agxData::EntityPtr &ptr)
AGXPHYSICS_EXPORT agx::Real const & maxNormalForce() const
AGXPHYSICS_EXPORT ContactPointInstance instance()
AGXPHYSICS_EXPORT agx::Real & elasticRestLengthShape2()
AGXPHYSICS_EXPORT agx::Vec3f & tangentV()
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr const & shape2() const
Shape number 2 in contact.
AGXPHYSICS_EXPORT agx::Vec3f const & tangentU() const
AGXPHYSICS_EXPORT agx::Vec4i8 const & indexSet() const
AGXPHYSICS_EXPORT agx::UInt8 & state()
Contact point state, such as impacting, resting etc.
AGXPHYSICS_EXPORT agx::Physics::Geometry::ShapePtr const & shape1() const
Shape number 1 in contact.
AGXPHYSICS_EXPORT const ContactPointInstance instance() const
AGXPHYSICS_EXPORT agx::UInt8 & faceFeature1()
The face feature of shape 1 in contact (e.g. voronoi region on triangle for trimesh).
AGXPHYSICS_EXPORT agx::Vec3f const & velocity() const
AGXPHYSICS_EXPORT agx::UInt8 & faceFeature2()
The face feature of shape 2 in contact (e.g. voronoi region on triangle for trimesh).
AGXPHYSICS_EXPORT agx::UInt8 const & state() const
Contact point state, such as impacting, resting etc.
AGXPHYSICS_EXPORT ContactPointPtr(const agxData::EntityInstance &instance)
AGXPHYSICS_EXPORT agx::Vec3 & localForce()
AGXPHYSICS_EXPORT agx::Real const & depth() const
AGXPHYSICS_EXPORT agx::Vec3 const & localForce() const
ContactPointData * getData()
AGXPHYSICS_EXPORT agx::Real const & elasticRestLengthShape1() const
AGXPHYSICS_EXPORT agx::Vec3 & point()
AGXPHYSICS_EXPORT agx::Bool const & enabled() const
AGXPHYSICS_EXPORT agx::Real & area()
AGXPHYSICS_EXPORT agx::Vec4i8 & indexSet()
const ContactPointData * getData() const
AGXPHYSICS_EXPORT agx::Bool & enabled()
ContactPointInstance InstanceType
AGXPHYSICS_EXPORT agx::Real & maxNormalForce()
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:196
A class holding 4 dimensional vectors and providing basic arithmetic.
Definition: Vec4Template.h:35
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:97
#define CALLABLE
Definition: macros.h:72
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
#define AGX_FORCE_INLINE
Definition: macros.h:58
Contains classes for low level data storage for AGX.
Definition: Container.h:23
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38
AGXCORE_EXPORT Model * getModel(const Path &path, const Path &_namespace=Path())
Definition: Object.h:364
UInt32 Index
Definition: Integer.h:52