AGX Dynamics  2.35.0.1
agxSDK/SimulationObject.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 #ifndef AGXSDK_SIMULATIONOBJECT_H
18 #define AGXSDK_SIMULATIONOBJECT_H
19 
20 #include <agx/agxPhysics_export.h>
21 
22 #include <agxCollide/Geometry.h>
23 #include <agx/RigidBody.h>
24 
25 namespace agxSDK {
26  class Simulation;
27 }
28 
29 
30 namespace agxSDK
31 {
32 
33 
40  {
41  public:
42 
44  SimulationObject( agxCollide::Geometry *geom, agx::RigidBody *body ) : m_geometry( geom ), m_body( body ) {}
45 
47  //explicit SimulationObject( agxCollide::GeometryRef geom, agx::RigidBodyRef body ) : m_geometry( geom ), m_body( body ) {}
48 
49  explicit SimulationObject( ) {}
50 
53  m_geometry = copy.m_geometry;
54  m_body = copy.m_body;
55  }
56 
57 
58  SimulationObject& operator= (const SimulationObject& copy )
59  {
60  if (this == &copy)
61  return *this;
62 
63  m_geometry = copy.m_geometry;
64  m_body = copy.m_body;
65  return *this;
66  }
67 
69 
71  agxCollide::Geometry *getGeometry() { return m_geometry.get(); }
72  void setGeometry( agxCollide::Geometry *geom ) { m_geometry = geom; }
73 
75  agx::RigidBody *getRigidBody() { return m_body.get(); }
76  void setRigidBody( agx::RigidBody * body ) { m_body = body; }
77 
79  operator agx::RigidBody *() { return m_body.get(); }
81  operator agxCollide::Geometry *() { return m_geometry.get(); }
83  operator const agx::RigidBody *() const { return m_body.get(); }
85  operator const agxCollide::Geometry *() const { return m_geometry.get(); }
86 
87 
88  // / \return true if obj contains the same geometry and body as this object.
89  // virtual bool operator ==(const SimulationObject& obj)
90  // {
91  // return ( m_geometry.get() == obj.m_geometry.get() && m_body.get() == obj.m_body.get());
92  // }
93 
94 
117  const agx::Vec3& halfExtent,
118  agxSDK::Simulation* simulation,
120  bool createGeometry=true,
121  bool createBody = true
122  );
123 
124 
148  agx::Real radius, agx::Real height,
149  agxSDK::Simulation* simulation,
151  bool createGeometry=true,
152  bool createBody=true
153  );
154 
177  agx::Real radius,
178  agxSDK::Simulation* simulation,
180  bool createGeometry=true,
181  bool createBody=true
182  );
183 
184 
208  agxSDK::Simulation* simulation,
210  bool createGeometry=true,
211  bool createBody=false
212  );
213 
240  const agx::String& filename, const agx::Real& sizeX, const agx::Real& sizeY,
241  const agx::Real& low, const agx::Real& high,
242  agxSDK::Simulation* simulation,
244  bool createGeometry=true,
245  bool createBody=false
246  );
247 
277  const agx::RealVector& heights,
278  size_t resolutionX,
279  size_t resolutionY,
280  agx::Real sizeX,
281  agx::Real sizeY,
282  agx::Real bottomMargin,
283  agxSDK::Simulation* simulation,
285  bool createGeometry=true,
286  bool createBody=false
287  );
288 
312  agx::Real radius, agx::Real height,
313  agxSDK::Simulation* simulation,
315  bool createGeometry=true,
316  bool createBody=true
317  );
318 
341  const agx::String& filename,
342  agxSDK::Simulation* simulation,
344  bool createGeometry=true,
345  bool createBody=true
346  );
347 
348 
371  agxCollide::Shape* cloneTrimesh,
372  agxSDK::Simulation* simulation,
374  bool createGeometry=true,
375  bool createBody=true
376  );
377 
401  const agx::String& filename,
402  agx::Real bottomMargin,
403  agxSDK::Simulation* simulation,
405  bool createGeometry=true,
406  bool createBody=true
407  );
408 
409 
410  protected:
413  };
414 
415 }
416 
417 
418 
419 #endif
420 
#define AGXPHYSICS_EXPORT
The geometry representation used by the collision detection engine.
Definition: Geometry.h:93
Base class for a shape.
Definition: Shape.h:54
Deprecated, used only for internal examples*.
static SimulationObject createHeightField(const agx::String &name, const agx::AffineMatrix4x4 &transform, const agx::RealVector &heights, size_t resolutionX, size_t resolutionY, agx::Real sizeX, agx::Real sizeY, agx::Real bottomMargin, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::STATIC, bool createGeometry=true, bool createBody=false)
Deprecated, used only for internal examples*.
agxCollide::Geometry * getGeometry()
void setRigidBody(agx::RigidBody *body)
SimulationObject()
Constructor for a SimulationObject that will store a reference to a Geometry and a RigidBody.
static SimulationObject createTrimesh(const agx::String &name, const agx::AffineMatrix4x4 &transform, const agx::String &filename, agx::Real bottomMargin, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
SimulationObject(const SimulationObject &copy)
Copy constructor.
static SimulationObject createBox(const agx::String &name, const agx::AffineMatrix4x4 &transform, const agx::Vec3 &halfExtent, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
static SimulationObject createPlane(const agx::String &name, const agx::AffineMatrix4x4 &transform, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::STATIC, bool createGeometry=true, bool createBody=false)
Deprecated, used only for internal examples*.
agxCollide::GeometryRef m_geometry
void setGeometry(agxCollide::Geometry *geom)
static SimulationObject createCapsule(const agx::String &name, const agx::AffineMatrix4x4 &transform, agx::Real radius, agx::Real height, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
static SimulationObject createSphere(const agx::String &name, const agx::AffineMatrix4x4 &transform, agx::Real radius, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
static SimulationObject createHeightField(const agx::String &name, const agx::AffineMatrix4x4 &transform, const agx::String &filename, const agx::Real &sizeX, const agx::Real &sizeY, const agx::Real &low, const agx::Real &high, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::STATIC, bool createGeometry=true, bool createBody=false)
Deprecated, used only for internal examples*.
SimulationObject(agxCollide::Geometry *geom, agx::RigidBody *body)
Constructor for a SimulationObject that will store a reference to a Geometry and a RigidBody.
static SimulationObject createTrimesh(const agx::String &name, const agx::AffineMatrix4x4 &transform, agxCollide::Shape *cloneTrimesh, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
static SimulationObject createTrimesh(const agx::String &name, const agx::AffineMatrix4x4 &transform, const agx::String &filename, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
static SimulationObject createCylinder(const agx::String &name, const agx::AffineMatrix4x4 &transform, agx::Real radius, agx::Real height, agxSDK::Simulation *simulation, agx::RigidBody::MotionControl motionControl=agx::RigidBody::DYNAMICS, bool createGeometry=true, bool createBody=true)
Deprecated, used only for internal examples*.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:66
@ STATIC
This body will never move.
Definition: RigidBody.h:67
@ DYNAMICS
This body moves from the influence of forces.
Definition: RigidBody.h:69
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
double Real
Definition: Real.h:42