AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RigidBody.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 AGX_RIGIDBODY_H
18 #define AGX_RIGIDBODY_H
19 
20 #include <agx/agx.h>
21 #include <agx/Frame.h>
22 #include <agx/MassProperties.h>
23 #include <agx/BitArray.h>
24 
26 
27 #include <agxCollide/Geometry.h>
28 
29 #include <agx/SleepThreshold.h>
30 #include <agx/RigidBodyState.h>
31 
32 #include <agx/macros.h>
33 
34 #ifdef _MSC_VER
35 # pragma warning(push)
36 # pragma warning(disable:4355) //Disable 'this' : used in base member initializer list warning
37 #endif
38 
39 namespace agx
40 {
41  class DynamicsSystem;
42  class AutoSleep;
43  class MergeSplitBodyStorage;
44  class InternalData;
45 
48 
53  {
54  public:
64  {
65  STATIC = 1,
66  KINEMATICS = 2,
67  DYNAMICS = 3
68  };
69 
70  public:
77  RigidBody( const agx::Name& name = "" );
78 
84  RigidBody( agxCollide::Geometry* geometry );
85 
89  RigidBody *clone() const;
90 
96  agx::Frame* getFrame();
97 
103  const agx::Frame* getFrame() const;
104 
110  void setTransform( const agx::AffineMatrix4x4& matrix );
111 
115  const agx::AffineMatrix4x4& getLocalTransform() const;
116 
121  void setLocalTransform( const agx::AffineMatrix4x4& matrix );
122 
126  agx::Vec3 getLocalPosition() const;
127 
132  void setLocalPosition( const agx::Vec3& p );
133 
140  void setLocalPosition( agx::Real x, agx::Real y, agx::Real z );
141 
146  void setRotation( const agx::Quat& q );
147 
152  void setRotation( const agx::EulerAngles& e);
153 
158  void setRotation( const agx::OrthoMatrix3x3& m );
159 
163  agx::Quat getLocalRotation() const;
164 
169  void setLocalRotation( const agx::Quat& q );
170 
175  void setLocalRotation( const agx::EulerAngles& e );
176 
180  agx::Frame* getParentFrame();
181 
185  const agx::Frame* getParentFrame() const;
186 
199  bool setParentFrame( agx::Frame* frame );
200 
205  void setPosition( const agx::Vec3& p );
206 
213  void setPosition( agx::Real x, agx::Real y, agx::Real z );
214 
223  agx::Frame* getCmFrame();
224 
233  const agx::Frame* getCmFrame() const;
234 
239  const agx::AffineMatrix4x4& getTransform() const;
240 
245  CALLABLE_UNIT("m/s")
246  agx::Vec3 getPosition() const;
247 
252  agx::Quat getRotation() const;
253 
265  void setVelocity( const agx::Vec3& velocity );
266 
278  void setVelocity( agx::Real vx, agx::Real vy, agx::Real vz );
279 
291  void setAngularVelocity( const agx::Vec3& angularVelocity );
292 
304  void setAngularVelocity( agx::Real vx, agx::Real vy, agx::Real vz );
305 
311  agx::Vec3 getVelocity() const;
312 
319  agx::Vec3 getAngularVelocity() const;
320 
329  agx::Vec3 getModelVelocity( const agx::Vec3& relPos = agx::Vec3() ) const;
330 
339  agx::Vec3 getModelAcceleration( const agx::Vec3& relPos = agx::Vec3() ) const;
340 
346  void setEnable( bool enable );
347 
352  bool getEnable() const;
353 
358  bool isEnabled() const;
359 
363  agx::RigidBody::MotionControl getMotionControl() const;
364 
372  void setMotionControl( agx::RigidBody::MotionControl control );
373 
377  agx::DynamicsSystem* getSystem();
378 
382  const agx::DynamicsSystem* getSystem() const;
383 
391  agx::Vec3 getLastForce() const;
392 
400  agx::Vec3 getLastTorque() const;
401 
412  agx::PropertyContainer* getPropertyContainer() const;
413 
417  bool hasPropertyContainer() const;
418 
423  void setPropertyContainer( agx::PropertyContainer* container );
424 
428  const agx::Name& getName() const;
429 
434  void setName( const agx::Name& name );
435 
442  agx::UInt32 getId() const;
443 
450  agx::AutoSleepThreshold* getAutoSleepThreshold();
451 
458  const agx::AutoSleepThreshold* getAutoSleepThreshold() const;
459 
466  void setAutoSleepThreshold( agx::AutoSleepThreshold* threshold );
467 
473  agx::MergeSplitThreshold* getMergeSplitThreshold();
474 
480  const agx::MergeSplitThreshold* getMergeSplitThreshold() const;
481 
488  void setMergeSplitThreshold( agx::MergeSplitThreshold* threshold );
489 
503  const agx::AffineMatrix4x4& getCmTransform() const;
504 
515  void setCmTransform( const agx::AffineMatrix4x4& matrix, bool synchronizeModel = true );
516 
520  agx::Vec3 getCmLocalTranslate() const;
521 
526  void setCmLocalTranslate(const agx::Vec3& translate);
527 
531  agx::Vec3 getCmPosition() const;
532 
539  void setCmPosition( const agx::Vec3& p, bool synchronizeModel = true );
540 
544  agx::Quat getCmRotation() const;
545 
554  void setCmRotation( const agx::Quat& q);
555 
564  void setCmRotation( const agx::EulerAngles& e);
565 
574  void setCmRotation( const agx::OrthoMatrix3x3& m);
575 
590  void setInertiaTensor( const agx::SPDMatrix3x3& inertiaTensor, const agx::AffineMatrix4x4& cmLocalTransform = agx::AffineMatrix4x4(), bool autogenerateCmOffset = false, bool autogenerateInertia = false );
591 
607  void setInertiaTensor( const agx::Vec3& inertiaDiagonal, const agx::AffineMatrix4x4& cmLocalTransform = agx::AffineMatrix4x4(), bool autogenerateCmOffset = false, bool autogenerateInertia = false );
608 
613  bool addAttachment( agx::Frame* frame, const agx::String& name );
614 
619  bool removeAttachment( const agx::String& name );
620 
626  Frame* getAttachment( const agx::String& name );
627 
631  const agx::MassProperties* getMassProperties() const;
632 
636  agx::MassProperties* getMassProperties();
637 
645  void setForce( const agx::Vec3& force );
646 
654  void setForce( agx::Real fx, agx::Real fy, agx::Real fz );
655 
663  void setTorque( const agx::Vec3& torque );
664 
672  void setTorque( agx::Real tx, agx::Real ty, agx::Real tz );
673 
679  void addForce( const agx::Vec3& force );
680 
686  void addForce( agx::Real fx, agx::Real fy, agx::Real fz );
687 
694  void addForceAtPosition( const agx::Vec3& force, const agx::Vec3& position );
695 
702  void addForceAtPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
703 
710  void addForceAtLocalPosition( const agx::Vec3& force, const agx::Vec3& position );
711 
718  void addForceAtLocalPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
719 
726  void addForceAtLocalCmPosition( const agx::Vec3& force, const agx::Vec3& position );
727 
734  void addForceAtLocalCmPosition( agx::Real fx, agx::Real fy, agx::Real fz, agx::Real px, agx::Real py, agx::Real pz );
735 
741  void addTorque( const agx::Vec3& torque );
742 
748  void addTorque( agx::Real tx, agx::Real ty, agx::Real tz );
749 
755  void addLocalTorque( agx::Real tx, agx::Real ty, agx::Real tz );
756 
762  void addLocalTorque( const agx::Vec3& torque );
763 
783  bool add( agxCollide::Geometry* geometry , const agx::AffineMatrix4x4& localTransform, bool incrementalMassCalculation = false );
784 
808  bool add( agxCollide::Geometry* geometry, bool incrementalMassCalculation = false );
809 
820  bool remove( agxCollide::Geometry* geometry, bool incrementalMassCalculation = false );
821 
827  const agxCollide::Geometry* getGeometry(const agx::Name& name) const;
828 
835  agxCollide::Geometry* getGeometry(const agx::Name& name);
836 
840  const agxCollide::GeometryRefVector& getGeometries() const;
841 
846  const agxCollide::GeometryRefVector& getOriginalGeometries() const;
847 
857  void moveTo( const agx::AffineMatrix4x4& target, agx::Real t );
858 
869  void moveTo( const agx::Vec3& targetPosition, const agx::Quat& targetRotation, agx::Real t );
870 
877  void updateMassProperties();
878 
889  void updateMassProperties( agx::UInt32 mask );
890 
897  agx::Real calculateMass() const;
898 
905  agx::Vec3 calculateCenterOfMassOffset( agx::Real mass = agx::Real() ) const;
906 
912  void setLinearVelocityZeroDamping( const agx::Vec3f& dir );
913 
919  void setAngularVelocityZeroDamping( const agx::Vec3f& dir );
920 
925  agx::Vec3f getLinearVelocityZeroDamping() const;
926 
931  agx::Vec3f getAngularVelocityZeroDamping() const;
932 
939  void setLinearVelocityDamping( float damping );
940 
947  void setLinearVelocityDamping( const agx::Vec3f& damping );
948 
955  void setAngularVelocityDamping( float damping );
956 
963  void setAngularVelocityDamping( const agx::Vec3f& damping );
964 
970  void setVelocityDamping( float damping );
971 
975  agx::Vec3f getLinearVelocityDamping() const;
976 
980  agx::Vec3f getAngularVelocityDamping() const;
981 
985  agx::Vec3 getLinearMomentum() const;
986 
990  agx::Vec3 getAngularMomentum() const;
991 
995  AGX_DEPRECATED(2.29.0.0)
996  agx::Real getPotentialEnergy() const;
997 
1001  AGX_DEPRECATED( 2.29.0.0 )
1002  agx::Real getTranslationalEnergy() const;
1003 
1007  AGX_DEPRECATED( 2.29.0.0 )
1008  agx::Real getRotationalEnergy() const;
1009 
1013  AGX_DEPRECATED( 2.29.0.0 )
1014  agx::Real getTotalEnergy() const;
1015 
1022  void setHandleAsParticle( bool handleAsParticle );
1023 
1027  bool getHandleAsParticle() const;
1028 
1033  agx::Vec3 getAcceleration() const;
1034 
1039  agx::Vec3 getAngularAcceleration() const;
1040 
1047  bool hasConstraints() const;
1048 
1055  agx::UInt16 getNumConstraints() const;
1056 
1061  agx::Referenced* getCustomData() const;
1062 
1072  void setCustomData( agx::Referenced* data );
1073 
1078  agx::Physics::RigidBodyPtr getEntity() const;
1079 
1084  void setEntity( agx::Physics::RigidBodyPtr entity );
1085 
1090  void transfer( agxData::EntityStorage* storage );
1091 
1095  agx::Vec3 getForce() const;
1096 
1100  agx::Vec3 getTorque() const;
1101 
1107  agx::MergeSplitBodyStorage* getBodyStorage();
1108 
1114  const agx::MergeSplitBodyStorage* getBodyStorage() const;
1115 
1119  bool hasBodyStorage() const;
1120 
1124  bool isPowerlineBody() const;
1125 
1129  void setIsPowerlineBody(bool isHydraulicBody);
1130 
1140  agx::AffineMatrix4x4 getMergedWorldTransform() const;
1141 
1145  bool isMerged() const;
1146 
1147 #ifndef SWIG
1148  inline static bool shouldIgnoreGravity(agx::RigidBodyState state)
1150  {
1151  return !state.enabled() ||
1152  state.motionControl() != agx::RigidBody::DYNAMICS ||
1153  state.powerline();
1154  }
1155 #endif
1156 
1162  {
1163  public:
1169 
1174  void setEnableMerge( bool flag );
1175 
1179  bool getEnableMerge() const;
1180 
1185  void setEnableSplit( bool flag );
1186 
1190  bool getEnableSplit() const;
1191 
1196  void setMergeOnlyWithStatic( bool flag );
1197 
1201  bool getMergeOnlyWithStatic() const;
1202 
1203  private:
1204  enum FLAGS
1205  {
1206  ENABLE_MERGE,
1207  ENABLE_SPLIT,
1208  ENABLE_MERGE_WITH_STATIC,
1209  NUM_ELEMENTS
1210  };
1211 
1213 
1214  private:
1215  FlagVector m_flags;
1216  };
1217 
1221  agx::RigidBody::MergeSplitProperties& getMergeSplitProperties();
1222  const agx::RigidBody::MergeSplitProperties& getMergeSplitProperties() const;
1223 
1228  {
1229  public:
1233  enum State {
1234  AWAKE = 0,
1235  TIRED = 1,
1236  ASLEEP = 2
1237  };
1238 
1249  void setSleeping( bool flag );
1250 
1254  State getState() const;
1255 
1259  bool isSleeping( ) const;
1260 
1266  void setEnable( bool flag );
1267 
1271  bool getEnable( ) const;
1272 
1276  float getRestTime() const;
1277 
1278  protected:
1279  // Never create this outside of a RigidBody.
1280  AutoSleepProperties( RigidBody *body = nullptr );
1281 
1282  private:
1294  void setSleeping( bool flag, State state );
1295 
1300  void setState( State state );
1301 
1302  friend class RigidBody;
1303  friend class AutoSleep;
1305 
1307  void setRestTime( float t );
1308 
1309  private:
1310  float m_restTime;
1311  bool m_enabled;
1312  agx::UInt8 m_state;
1313  RigidBody *m_body;
1314  };
1315 
1319  agx::RigidBody::AutoSleepProperties& getAutoSleepProperties();
1320  const agx::RigidBody::AutoSleepProperties& getAutoSleepProperties() const;
1321 
1323 
1324  protected:
1325  friend class DynamicsSystem;
1326  friend class GeometryListener;
1328  friend class MergeSplit;
1330  friend class AutoSleepProperties;
1331 
1332  virtual ~RigidBody();
1333 
1334  // Never use these
1335  RigidBody( const agx::RigidBody& );
1336  RigidBody( const agx::Name& name, agx::Physics::RigidBodyPtr entity );
1337  RigidBody& operator = ( const agx::RigidBody& ) { return *this; }
1338 
1343  void setId( agx::UInt32 id );
1344 
1349  void setSystem( agx::DynamicsSystem* system );
1350 
1355  void setBodyStorage( agx::MergeSplitBodyStorage* bodyStorage );
1356 
1360  void clearBodyStorage();
1361 
1368  void incrementalMassPropertyUpdate( agx::UInt32 mask, int sign, const agxCollide::Geometry* geometry );
1369 
1370  private:
1371  void init( const agx::Name& name );
1372 
1373  void incrementNumConstraints();
1374  void decrementNumConstraints();
1375  void resetNumConstraints();
1376 
1377  void removeAllGeometries();
1378  void appendGeometry( agxCollide::Geometry* geometry );
1379  void removeGeometry( agx::Physics::GeometryPtr before, agx::Physics::GeometryPtr toBeRemoved );
1380 
1382  friend class InternalData;
1386  agx::Referenced* getInternalData() const;
1387 
1391  void setInternalData( agx::Referenced* data );
1393 
1394  private:
1395  // Low level data.
1396  Physics::RigidBodyRef m_entity;
1397 
1398  mutable PropertyContainerRef m_propertyContainer;
1399 
1400  DynamicsSystem* m_mainSystem;
1401 
1402  AutoSleepThresholdRef m_autoSleepThreshold;
1403  MergeSplitThresholdRef m_mergeSplitThreshold;
1404 
1405  FrameRef m_frame;
1406  FrameRef m_cmFrame;
1407 
1408  MassProperties m_massProperties;
1409 
1410  agxCollide::GeometryRefVector m_geometries;
1411 
1412  typedef HashTable<agx::String, FrameRef > FrameTable;
1413  FrameTable m_namedAttachments;
1414 
1415  agx::ref_ptr<agx::Referenced> m_customData;
1416  agx::ref_ptr<agx::Referenced> m_internalData;
1417 
1418  MergeSplitBodyStorage* m_bodyStorage;
1419  MergeSplitProperties m_msProperties;
1420  AutoSleepProperties m_autoSleepProperties;
1421  };
1422 
1423  AGX_FORCE_INLINE bool RigidBody::getEnable() const
1424  {
1425  return m_entity.state().enabled();
1426  }
1427 
1429  {
1430  return m_entity.state().enabled();
1431  }
1432 
1434  {
1435  return (MotionControl)m_entity.state().motionControl();
1436  }
1437 
1439  {
1440  return ( m_propertyContainer.isValid() );
1441  }
1442 
1444  {
1445  if ( m_propertyContainer == nullptr )
1446  m_propertyContainer = new agx::PropertyContainer;
1447  return m_propertyContainer;
1448  }
1449 
1451  {
1452  return m_entity;
1453  }
1454 
1456  {
1457  return m_entity.id();
1458  }
1459 
1461  {
1462  return m_autoSleepThreshold;
1463  }
1464 
1466  {
1467  return m_autoSleepThreshold;
1468  }
1469 
1471  {
1472  return m_mergeSplitThreshold;
1473  }
1474 
1476  {
1477  return m_mergeSplitThreshold;
1478  }
1479 
1481  {
1482  return m_frame.get();
1483  }
1484 
1486  {
1487  return m_frame.get();
1488  }
1489 
1491  {
1492  return m_cmFrame.get();
1493  }
1494 
1496  {
1497  return m_cmFrame.get();
1498  }
1499 
1500  AGX_FORCE_INLINE const AffineMatrix4x4& RigidBody::getCmTransform() const
1501  {
1502  return m_entity.cmTransform();
1503  }
1504 
1506  {
1507  return m_entity.velocity();
1508  }
1509 
1511  {
1512  return m_entity.angularVelocity();
1513  }
1514 
1516  {
1517  return getCmFrame()->getLocalTranslate();
1518  }
1519 
1521  {
1522  return getCmTransform().getTranslate();
1523  }
1524 
1526  {
1527  return getCmTransform().getRotate();
1528  }
1529 
1531  {
1532  return &m_massProperties;
1533  }
1534 
1536  {
1537  return &m_massProperties;
1538  }
1539 
1541  {
1542  return m_entity.state().handleAsParticle();
1543  }
1544 
1546  {
1547  return m_flags[ENABLE_MERGE];
1548  }
1549 
1551  {
1552  return m_flags[ENABLE_SPLIT];
1553  }
1554 
1556  {
1557  return m_flags[ENABLE_MERGE_WITH_STATIC];
1558  }
1559 
1561  {
1562  return m_msProperties;
1563  }
1564 
1566  {
1567  return m_msProperties;
1568  }
1569 
1571  {
1572  return (State)m_state;
1573  }
1574 
1576  {
1577  return m_enabled;
1578  }
1579 
1581  {
1582  return getState() == ASLEEP;
1583  }
1584 
1586  {
1587  return m_restTime;
1588  }
1589 
1590  AGX_FORCE_INLINE void RigidBody::AutoSleepProperties::setRestTime( float t )
1591  {
1592  m_restTime = t;
1593  }
1594 
1596  {
1597  return m_autoSleepProperties;
1598  }
1600  {
1601  return m_autoSleepProperties;
1602  }
1603 
1605  {
1606  return m_entity.linearAcceleration();
1607  }
1608 
1610  {
1611  return m_entity.angularAcceleration();
1612  }
1613 
1615  {
1616  return m_entity.numConstraints() > 0;
1617  }
1618 
1620  {
1621  return m_entity.numConstraints();
1622  }
1623 
1625  {
1626  return m_customData.get();
1627  }
1628 
1630  {
1631  return m_entity.modelTransform();
1632  }
1633 
1635  {
1636  return m_entity.modelTransform().getTranslate();
1637  }
1638 
1640  {
1641  return m_entity.modelTransform().getRotate();
1642  }
1643 
1644  inline Referenced* RigidBody::getInternalData() const
1645  {
1646  return m_internalData;
1647  }
1648 
1650  {
1651  setVelocity(agx::Vec3(vx,vy,vz));
1652  }
1653 
1655  {
1656  setAngularVelocity(agx::Vec3(vx,vy,vz));
1657  }
1658 
1660  {
1661  addForce( agx::Vec3(fx,fy,fz) );
1662  }
1663 
1665  {
1666  addForceAtPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1667  }
1668 
1670  {
1671  addForceAtLocalPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1672  }
1673 
1675  {
1676  addForceAtLocalCmPosition( agx::Vec3(fx,fy,fz), agx::Vec3(px,py,pz) );
1677  }
1678 
1680  {
1681  addTorque( agx::Vec3(tx,ty,tz) );
1682  }
1683 
1685  {
1686  addLocalTorque( agx::Vec3(tx, ty, tz) );
1687  }
1688 
1690  {
1691  setForce( agx::Vec3(fx,fy,fz) );
1692  }
1693 
1695  {
1696  setTorque( agx::Vec3(tx,ty,tz) );
1697  }
1698 
1699  inline bool RigidBody::isPowerlineBody() const
1700  {
1701  return m_entity.state().powerline();
1702  }
1703 
1704  inline void RigidBody::setIsPowerlineBody(bool isHydraulicBody)
1705  {
1706  m_entity.state().setPowerline(isHydraulicBody);
1707  }
1708 
1709 } // namespace agx
1710 
1711 #ifdef _MSC_VER
1712 # pragma warning(pop)
1713 #endif
1714 
1715 #endif
agx::RigidBody::AutoSleepProperties & getAutoSleepProperties()
Definition: RigidBody.h:1595
void AGXPHYSICS_EXPORT init()
Initialize agx.
void addTorque(const agx::Vec3 &torque)
Adds the specified torque, given in world coordinate frame, that will be affecting this body in the n...
agx::Referenced * getCustomData() const
Definition: RigidBody.h:1624
void setIsPowerlineBody(bool isHydraulicBody)
Internal method.
Definition: RigidBody.h:1704
agx::Frame * getFrame()
Returns the model frame containing model the transformation and utilities to manipulate position...
Definition: RigidBody.h:1480
agx::Quat getCmRotation() const
Definition: RigidBody.h:1525
agx::Vec3 getCmLocalTranslate() const
Definition: RigidBody.h:1515
Data holder for merge-split properties.
Definition: RigidBody.h:1161
void addForceAtPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force, given in the World coordinate frame, applied at a point specified in world coordinate fr...
agx::RigidBody::MergeSplitProperties & getMergeSplitProperties()
Definition: RigidBody.h:1560
bool hasPropertyContainer() const
Definition: RigidBody.h:1438
uint8_t UInt8
Definition: Integer.h:38
void addLocalTorque(agx::Real tx, agx::Real ty, agx::Real tz)
Adds the specified torque, given in Center of Mass coordinate frame that will be affecting this body ...
Definition: RigidBody.h:1684
#define AGXPHYSICS_EXPORT
agx::Quat getRotation() const
Current model frame rotation, given in world coordinate frame.
Definition: RigidBody.h:1639
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
bool isPowerlineBody() const
Definition: RigidBody.h:1699
agx::Vec3 getAngularAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
Definition: RigidBody.h:1609
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:62
agx::Vec3 getAngularVelocity() const
Angular velocity in world coordinate frame.
Definition: RigidBody.h:1510
bool hasConstraints() const
Definition: RigidBody.h:1614
void setForce(const agx::Vec3 &force)
Explicitly set the force, given in world coordinate frame, that will be affecting this body in the ne...
Base class providing referencing counted objects.
Definition: Referenced.h:113
agx::UInt32 getId() const
Internal method.
Definition: RigidBody.h:1455
The geometry representation used by the collision detection engine.
Definition: Geometry.h:88
agx::Vec3 getVelocity() const
Velocity of center of mass frame origin, in world coordinate frame.
Definition: RigidBody.h:1505
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
Definition: EulerAngles.h:72
agx::MergeSplitThreshold * getMergeSplitThreshold()
Returns custom merge-split parameters for this rigid body.
Definition: RigidBody.h:1470
Pointer to a entity instance of type Physics.RigidBody.
Class which will go through contacting/separating bodies and determine if the bodies can be merged (g...
Definition: MergeSplit.h:37
agx::UInt16 getNumConstraints() const
Definition: RigidBody.h:1619
Class that is a container of named properties.
Definition: Property.h:158
void addForceAtLocalPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force, given in the world coordinate frame, applied at a point specified in the local Model coo...
agx::AutoSleepThreshold * getAutoSleepThreshold()
Returns custom auto-sleep parameters for this rigid body.
Definition: RigidBody.h:1460
Pointer to a entity instance of type Physics.Geometry.
#define CALLABLE_UNIT(param)
Definition: Object.h:77
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
Data holder for auto-sleep properties.
Definition: RigidBody.h:1227
void addForce(const agx::Vec3 &force)
Add the specified force, given in world coordinate frame, that will be affecting this body in the nex...
const agx::AffineMatrix4x4 & getTransform() const
Current model frame transform, given in world coordinate frame.
Definition: RigidBody.h:1629
Class for rigid body inertia tensor and mass.
void getRotate(T &angle, T &x, T &y, T &z) const
Get the angle and vector components represented by the quaternion.
const agx::MassProperties * getMassProperties() const
Definition: RigidBody.h:1535
agx::Vec3 getPosition() const
Current model frame position, given in world coordinate frame.
Definition: RigidBody.h:1634
agx::Vec3 getAcceleration() const
Will always be 0 for KINEMATIC and STATIC bodies.
Definition: RigidBody.h:1604
agx::Frame * getCmFrame()
Return the center of mass (CM) frame of this rigid body.
Definition: RigidBody.h:1490
const agx::AffineMatrix4x4 & getCmTransform() const
Convenience methods for center of mass frame.
Definition: RigidBody.h:1500
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:52
bool isEnabled() const
Access the state enable flag.
Definition: RigidBody.h:1428
Internal data for any object, ObjT, with methods: agx::Referenced* ObjT::getInternalData() const; voi...
Definition: InternalData.h:32
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
#define CALLABLE
Definition: Object.h:76
This body moves from the influence of forces.
Definition: RigidBody.h:67
Book keeping of a body which can be merged with other bodies.
agx::PropertyContainer * getPropertyContainer() const
Access property container of this rigid body.
Definition: RigidBody.h:1443
agx::Vec3 getCmPosition() const
Definition: RigidBody.h:1520
The complete physical system with bodies, interactions, data layout, time stepper, and solver.
State
Specifies the state of auto sleep for this body.
Definition: RigidBody.h:1233
void addForceAtLocalCmPosition(const agx::Vec3 &force, const agx::Vec3 &position)
Add a force given in world coordinate frame, applied at a point specified in the local Center of Mass...
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
Class that will investigate bodies to see if they are resting, that is if linear/angular velocity and...
Definition: AutoSleep.h:40
#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:206
void setTorque(const agx::Vec3 &torque)
Explicitly set the torque, given in world coordinate frame, that will be affecting this body in the n...
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
bool getHandleAsParticle() const
Definition: RigidBody.h:1540
uint16_t UInt16
Definition: Integer.h:39
agx::RigidBody::MotionControl getMotionControl() const
Definition: RigidBody.h:1433
double Real
Definition: Real.h:42
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:63
agx::Vector< agx::ref_ptr< Geometry > > GeometryRefVector
#define AGX_DEPRECATED(since)
Definition: Object.h:93
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
Definition: RigidBody.h:1450
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:101
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:100
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.
void setAngularVelocity(const agx::Vec3 &angularVelocity)
Set the angular velocity of the center of mass of this rigid body.
Specialized types of matrices for holding orthogonal transformation matrices.
T sign(T v)
Definition: Math.h:326
AGX_DECLARE_VECTOR_TYPES(Clock)
void setVelocity(const agx::Vec3 &velocity)
Set the linear velocity of the center of mass of this rigid body.