AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
Cylinder.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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 having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid 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
17#ifndef AGXCOLLIDE_CYLINDER_H
18#define AGXCOLLIDE_CYLINDER_H
19
21
22#include <agx/agx.h>
24#include <agxCollide/Shape.h>
25#include <agxCollide/Capsule.h>
27
28namespace 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
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
94 agx::Physics::Geometry::CylinderPtr getEntity() const;
95
98
99 protected:
100
103
105 virtual ~Cylinder();
106 };
107
108 /* Implementation */
109 inline agx::Physics::Geometry::CylinderPtr Cylinder::getEntity() const
110 {
111 return m_entity;
112 }
113 AGX_FORCE_INLINE agx::Real Cylinder::getHeight() const
114 {
115 return getEntity().height();
116 }
117 AGX_FORCE_INLINE agx::Real Cylinder::getRadius() const
118 {
119 return getEntity().radius();
120 }
121 AGX_FORCE_INLINE agx::Real Cylinder::getVolume() const
122 {
123 return getRadius() * getRadius() * getHeight() * agx::PI;
124 }
125
126 AGX_FORCE_INLINE BoundingAABB Cylinder::calculateBound(const agx::AffineMatrix4x4& transform, const agx::Real radius, const agx::Real height)
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
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
Axis aligned bounding box implementation.
A cylinder shape for geometric intersection tests.
Definition Cylinder.h:37
virtual Shape * clone() const override
Create a clone.
agx::SPDMatrix3x3 calculateInertia(agx::Real mass) const override
Calculate the inertia of this Cylinder.
virtual agx::Vec3 getSupportPoint(const agx::Vec3 &supportDirection) const override
Returns the support point on face of the shape.
virtual const BoundingAABB & updateBoundingVolume() override
Calculate the bounding volume based on the current Shape parameters including transformation.
virtual BoundingAABB calculateLocalBound() const override
Calculate the bounding volume in the local coordinate system.
void setRadius(const agx::Real radius)
Set the radius of a cylinder.
void setHeight(const agx::Real height)
Set the height of a cylinder.
Cylinder(const agx::Real radius, const agx::Real height)
Constructor.
void set(const agx::Real radius, const agx::Real height)
Set the radius and height of a cylinder.
The geometry representation used by the collision detection engine.
Definition Geometry.h:92
Base class for a shape.
Definition Shape.h:54
Specialized type of matrices for holding symmetric positive definite matrices.
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition macros.h:96
#define AGX_FORCE_INLINE
Definition macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
const Real PI
Definition Math.h:63
double Real
Definition Real.h:42