AGX Dynamics 2.40.1.2
Loading...
Searching...
No Matches
agxCollide::Cone Class Reference

A right circular cone shape for geometric intersection tests. More...

#include <Cone.h>

+ Inheritance diagram for agxCollide::Cone:

Public Member Functions

 Cone (agx::Real topRadius, agx::Real bottomRadius, agx::Real height)
 Creates a cone.
 
agx::SPDMatrix3x3 calculateInertia (agx::Real mass) const override
 Calculate the inertia of the Cone.
 
virtual BoundingAABB calculateLocalBound () const override
 Calculate the bounding volume in the local coordinate system.
 
virtual Shapeclone () const override
 Create a clone.
 
agx::Real getAngle () const
 
agx::Real getBottomRadius () const
 
virtual agx::Vec3 getCenter () const override
 
agx::Real getHeight () const
 
virtual agx::Vec3 getSupportPoint (const agx::Vec3 &supportDirection) const override
 Returns the support point on face of the shape.
 
agx::Real getTopRadius () const
 
agx::Real getTruncatedHeight () const
 
virtual agx::Real getVolume () const override
 Calculate the volume of this cylinder.
 
virtual bool hasSupportFunction () const override
 
void set (agx::Real topRadius, agx::Real bottomRadius, agx::Real height)
 Sets all parameters for the cone.
 
void setBottomRadius (agx::Real r)
 Sets the bottom radius for the cone.
 
void setHeight (agx::Real height)
 Sets the height of the cone.
 
void setTopRadius (agx::Real r)
 Sets the top radius for the cone.
 
virtual const BoundingAABBupdateBoundingVolume () override
 Calculate the bounding volume based on the current Shape parameters including transformation.
 
- Public Member Functions inherited from agxCollide::Shape
ShapeGroupasGroup ()
 Auto-cast shape to group.
 
const ShapeGroupasGroup () const
 Auto-cast shape to group.
 
virtual agx::Real calculateBoundingRadius (BoundingAABB &localAABB) const
 Calculate the bounding volume (AABB) into localAABB and calculate the bounding radius based on the new AABB size.
 
virtual agx::SPDMatrix3x3 calculateInertia (agx::Real mass) const =0
 Calculate the inertia for the shape given a mass.
 
virtual BoundingAABB calculateLocalBound () const =0
 Calculate the bounding volume in the local coordinate system.
 
virtual Shapeclone () const
 Create a clone.
 
const BoundingAABBgetBoundingVolume () const
 
virtual agx::Vec3 getCenter () const
 
agx::Physics::Geometry::ShapePtr getEntity () const
 
GeometrygetGeometry ()
 
const GeometrygetGeometry () const
 
agx::AffineMatrix4x4 getLocalTransform () const
 
agx::UInt32 getModifiedCount () const
 
agxCollide::RenderDatagetRenderData ()
 
const agxCollide::RenderDatagetRenderData () const
 If this is a ShapeGroup, then this method will return nullptr as the render data is stored in the actual children (Box, Mesh etc.
 
virtual agx::Vec3 getSupportPoint (const agx::Vec3 &supportDirection) const
 Returns the support point on face of the shape.
 
agx::AffineMatrix4x4 getTransform () const
 
agx::UInt8 getType () const
 
const char * getTypeName () const
 
virtual agx::Real getVolume () const =0
 Return the volume of the shape.
 
virtual bool hasSupportFunction () const
 
bool isGroup () const
 
virtual void propagateTransform (const agx::AffineMatrix4x4 &transform)
 
virtual void setRenderData (agxCollide::RenderData *renderData)
 Store render data with the Shape.
 
virtual const BoundingAABBupdateBoundingVolume ()=0
 Calculate the bounding volume based on the current Shape parameters including transformation.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Static Public Member Functions

static agx::Real computeTruncatedHeight (agx::Real topRadius, agx::Real bottomRadius, agx::Real height)
 Compute the height of the truncated part of the cone.
 
- Static Public Member Functions inherited from agxCollide::Shape
static BoundingAABB calculateBound (const agx::AffineMatrix4x4 &transform, const BoundingAABB &localBound)
 
static const char * getTypeName (agx::UInt8 type)
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 

Protected Member Functions

 Cone ()
 Hidden default constructor.
 
virtual ~Cone ()
 Destructor.
 
- Protected Member Functions inherited from agxCollide::Shape
 Shape (Type type, agx::Physics::Geometry::ShapePtr entity=agx::Physics::Geometry::ShapeModel::createInstance())
 Constructor.
 
virtual ~Shape ()
 Destructor.
 
agx::UInt32 incrementModifiedCount ()
 Increment the number of times the shape have been modified.
 
void syncronizeShapeIndex ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Additional Inherited Members

- Public Types inherited from agxCollide::Shape
enum  Type {
  GROUP , BOX , CAPSULE , CYLINDER ,
  LINE , PLANE , SPHERE , TRIMESH ,
  HEIGHT_FIELD , CONVEX , WIRE_SHAPE , CONE ,
  HOLLOW_CONE , HOLLOW_CYLINDER , NUM_TYPES
}
 Define the type of a Shape. More...
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agxCollide::Shape
agx::Physics::Geometry::ShapeRef m_entity
 
Geometrym_geometry
 
agx::ref_ptr< agx::Referencedm_internalData
 
ShapeGroupm_parent
 
agxCollide::RenderDataRef m_renderData
 
agx::Index m_shapeIndex
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

A right circular cone shape for geometric intersection tests.

See manual for information about limitations and which shape pairs that are supported for cones.

The cone can be configured as an orinary cone (topRadius==0) or a truncated Cone (topRadius != 0 ). The shape is defined along the Y-axis with the base described by the bottom radius in the XZ-plane at Y=0. The top of the cone, described by topRadius, is positioned at height along the positive Y axis.

Requirements for the cone parameters are:

  • height > 0
  • topRadius >= 0
  • bottomRadius > topRadius

If the topRadius is larger than 0, then the top part of the cone is truncated.

Definition at line 48 of file Cone.h.

Constructor & Destructor Documentation

◆ Cone() [1/2]

agxCollide::Cone::Cone ( agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height 
)

Creates a cone.

◆ Cone() [2/2]

agxCollide::Cone::Cone ( )
protected

Hidden default constructor.

◆ ~Cone()

virtual agxCollide::Cone::~Cone ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ calculateInertia()

agx::SPDMatrix3x3 agxCollide::Cone::calculateInertia ( agx::Real  mass) const
overridevirtual

Calculate the inertia of the Cone.

Returns
the calculated inertia tensor for this Cone in the local coordinate system.

Implements agxCollide::Shape.

◆ calculateLocalBound()

virtual BoundingAABB agxCollide::Cone::calculateLocalBound ( ) const
overridevirtual

Calculate the bounding volume in the local coordinate system.

Returns
the calculated bounding volume.

Implements agxCollide::Shape.

◆ clone()

virtual Shape * agxCollide::Cone::clone ( ) const
overridevirtual

Create a clone.

Reimplemented from agxCollide::Shape.

◆ computeTruncatedHeight()

static agx::Real agxCollide::Cone::computeTruncatedHeight ( agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height 
)
static

Compute the height of the truncated part of the cone.

◆ getAngle()

agx::Real agxCollide::Cone::getAngle ( ) const
Returns
The angle between the cone axis and side. This value is the same as half the opening angle.

◆ getBottomRadius()

agx::Real agxCollide::Cone::getBottomRadius ( ) const
inline
Returns
The bottom radius for the cone

Definition at line 167 of file Cone.h.

◆ getCenter()

virtual agx::Vec3 agxCollide::Cone::getCenter ( ) const
overridevirtual
Returns
the center (local, relative to the Shape) of the shape. This is in most cases 0,0,0 - but can have other positions, e.g. in Convex shapes.

Reimplemented from agxCollide::Shape.

◆ getHeight()

agx::Real agxCollide::Cone::getHeight ( ) const
inline
Returns
The height of the cone

Definition at line 172 of file Cone.h.

◆ getSupportPoint()

virtual agx::Vec3 agxCollide::Cone::getSupportPoint ( const agx::Vec3 supportDirection) const
overridevirtual

Returns the support point on face of the shape.

Parameters
supportDirection- Direction in shape coords where to find a support point

Reimplemented from agxCollide::Shape.

◆ getTopRadius()

agx::Real agxCollide::Cone::getTopRadius ( ) const
inline
Returns
The top radius for the cone

Definition at line 162 of file Cone.h.

◆ getTruncatedHeight()

agx::Real agxCollide::Cone::getTruncatedHeight ( ) const
Returns
The height of the truncated part. This value is non-zero if topRadius is > 0.

◆ getVolume()

virtual agx::Real agxCollide::Cone::getVolume ( ) const
overridevirtual

Calculate the volume of this cylinder.

Returns
the calculated volume for this cylinder.

Implements agxCollide::Shape.

◆ hasSupportFunction()

virtual bool agxCollide::Cone::hasSupportFunction ( ) const
overridevirtual
Returns
true if the shape implements its own support function, used by Minkowski difference based collision algorithms.

Reimplemented from agxCollide::Shape.

◆ set()

void agxCollide::Cone::set ( agx::Real  topRadius,
agx::Real  bottomRadius,
agx::Real  height 
)

Sets all parameters for the cone.

Parameters
topRadius- New top radius
bottomRadius- New bottom radius.
height- New height for the cone.

◆ setBottomRadius()

void agxCollide::Cone::setBottomRadius ( agx::Real  r)

Sets the bottom radius for the cone.

◆ setHeight()

void agxCollide::Cone::setHeight ( agx::Real  height)

Sets the height of the cone.

◆ setTopRadius()

void agxCollide::Cone::setTopRadius ( agx::Real  r)

Sets the top radius for the cone.

◆ updateBoundingVolume()

virtual const BoundingAABB & agxCollide::Cone::updateBoundingVolume ( )
overridevirtual

Calculate the bounding volume based on the current Shape parameters including transformation.

Returns
new calculated bounding volume

Implements agxCollide::Shape.


The documentation for this class was generated from the following file: