AGXDynamics  2.35.0.2
Cylinder.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 AGXCOLLIDE_CYLINDER_H
18 #define AGXCOLLIDE_CYLINDER_H
19 
20 #include <agx/agxPhysics_export.h>
21 
22 #include <agx/agx.h>
24 #include <agxCollide/Shape.h>
25 #include <agxCollide/Capsule.h>
26 #include <agxStream/Serializable.h>
27 
28 namespace agxCollide
29 {
30 
37  {
38  public:
44  Cylinder( const agx::Real radius, const agx::Real height );
45 
50  void setHeight( const agx::Real height );
51 
56  void setRadius( const agx::Real radius );
57 
63  void set( const agx::Real radius, const agx::Real height );
64 
66  agx::Real getHeight() const;
67 
69  agx::Real getRadius() const;
70 
75  agx::SPDMatrix3x3 calculateInertia(agx::Real mass) const override;
76 
81  virtual agx::Real getVolume() const override;
82 
83  virtual bool hasSupportFunction() const override;
84  virtual Shape *clone() const override;
85 
86  virtual agx::Vec3 getSupportPoint( const agx::Vec3& supportDirection ) const override;
87  virtual const BoundingAABB& updateBoundingVolume() override;
88  virtual BoundingAABB calculateLocalBound() const override;
89  static BoundingAABB calculateBound(const agx::AffineMatrix4x4& transform, const agx::Real radius, const agx::Real height);
90 
92 
93 
95 
98 
99  protected:
100 
102  Cylinder();
103 
105  virtual ~Cylinder();
106  };
107 
108  /* Implementation */
110  {
111  return m_entity;
112  }
114  {
115  return getEntity().height();
116  }
118  {
119  return getEntity().radius();
120  }
122  {
123  return getRadius() * getRadius() * getHeight() * agx::PI;
124  }
125 
127  {
128  return Capsule::calculateBound(transform, radius, height); // TODO The cylinder bound can be further optimized
129  }
130 
131  inline bool Cylinder::hasSupportFunction() const
132  {
133  return true;
134  }
135 
136 }
137 
138 #endif
agxPhysics_export.h
Shape.h
agx::Physics::Geometry::CylinderPtr
Pointer to a entity instance of type Physics.Geometry.Cylinder.
Definition: CylinderEntity.h:165
agx::Real
double Real
Definition: Real.h:42
agxCollide::Cylinder
A cylinder shape for geometric intersection tests.
Definition: Cylinder.h:36
agxCollide::Cylinder::hasSupportFunction
virtual bool hasSupportFunction() const override
Definition: Cylinder.h:131
agxData::transform
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agx::AffineMatrix4x4T< Real >
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agx::PI
const Real PI
Definition: Math.h:63
agxCollide::Capsule::calculateBound
static BoundingAABB calculateBound(const agx::AffineMatrix4x4 &transform, const agx::Real radius, const agx::Real height)
Definition: Capsule.h:117
agxCollide::BoundingAABB
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
AGXSTREAM_DECLARE_SERIALIZABLE
#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:207
agxCollide::Shape::m_entity
agx::Physics::Geometry::ShapeRef m_entity
Definition: Shape.h:266
agxCollide::Shape::getEntity
agx::Physics::Geometry::ShapePtr getEntity() const
Definition: Shape.h:396
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxCollide::Shape
Base class for a shape.
Definition: Shape.h:53
agxCollide::Cylinder::getRadius
agx::Real getRadius() const
Definition: Cylinder.h:117
agx::SPDMatrix3x3
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
Serializable.h
agxCollide::Cylinder::getHeight
agx::Real getHeight() const
Definition: Cylinder.h:113
agx.h
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
CylinderEntity.h
agxCollide::AGX_DECLARE_POINTER_TYPES
AGX_DECLARE_POINTER_TYPES(SpaceListener)
agxCollide::Cylinder::calculateBound
static BoundingAABB calculateBound(const agx::AffineMatrix4x4 &transform, const agx::Real radius, const agx::Real height)
Definition: Cylinder.h:126
agx::Vec3T< Real >
Capsule.h
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agxCollide::Cylinder::getVolume
virtual agx::Real getVolume() const override
Calculate the volume of this cylinder.
Definition: Cylinder.h:121
agxData::getEntity
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.