ReactPhysics3D  v0.10.2
C++ Physics engine library
Loading...
Searching...
No Matches
reactphysics3d::ConcaveShape Class Referenceabstract

This abstract class represents a concave collision shape associated with a body that is used during the narrow-phase collision detection. More...

#include <include/reactphysics3d/collision/shapes/ConcaveShape.h>

Inheritance diagram for reactphysics3d::ConcaveShape:
reactphysics3d::CollisionShape reactphysics3d::ConcaveMeshShape reactphysics3d::HeightFieldShape

Public Member Functions

 ConcaveShape (CollisionShapeName name, MemoryAllocator &allocator, const Vector3 &scaling)
 Constructor.
 
virtual ~ConcaveShape () override=default
 Destructor.
 
 ConcaveShape (const ConcaveShape &shape)=delete
 Deleted copy-constructor.
 
ConcaveShapeoperator= (const ConcaveShape &shape)=delete
 Deleted assignment operator.
 
TriangleRaycastSide getRaycastTestType () const
 Return the raycast test type (front, back, front-back)
 
void setRaycastTestType (TriangleRaycastSide testType)
 
const Vector3getScale () const
 Return the scale of the shape.
 
virtual void setScale (const Vector3 &scale)
 Set the scale of the shape.
 
virtual Vector3 getLocalInertiaTensor (decimal mass) const override
 Return the local inertia tensor of the collision shape.
 
virtual bool isConvex () const override
 Return true if the collision shape is convex, false if it is concave.
 
virtual bool isPolyhedron () const override
 Return true if the collision shape is a polyhedron.
 
virtual void computeOverlappingTriangles (const AABB &localAABB, Array< Vector3 > &triangleVertices, Array< Vector3 > &triangleVerticesNormals, Array< uint32 > &shapeIds, MemoryAllocator &allocator) const =0
 Use a callback method on all triangles of the concave shape inside a given AABB.
 
virtual decimal getVolume () const override
 Compute and return the volume of the collision shape.
 
- Public Member Functions inherited from reactphysics3d::CollisionShape
 CollisionShape (CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator)
 Constructor.
 
virtual ~CollisionShape ()=default
 Destructor.
 
 CollisionShape (const CollisionShape &shape)=delete
 Deleted copy-constructor.
 
CollisionShapeoperator= (const CollisionShape &shape)=delete
 Deleted assignment operator.
 
CollisionShapeName getName () const
 Return the name of the collision shape.
 
CollisionShapeType getType () const
 Return the type of the collision shape.
 
virtual AABB getLocalBounds () const =0
 Return the local bounds of the shape in x, y and z directions.
 
uint32 getId () const
 Return the id of the shape.
 
virtual AABB computeTransformedAABB (const Transform &transform) const
 Compute the transformed AABB of the collision shape given a transform.
 
virtual std::string to_string () const =0
 Return the string representation of the shape.
 

Detailed Description

This abstract class represents a concave collision shape associated with a body that is used during the narrow-phase collision detection.

Member Function Documentation

◆ computeOverlappingTriangles()

virtual void reactphysics3d::ConcaveShape::computeOverlappingTriangles ( const AABB localAABB,
Array< Vector3 > &  triangleVertices,
Array< Vector3 > &  triangleVerticesNormals,
Array< uint32 > &  shapeIds,
MemoryAllocator allocator 
) const
pure virtual

Use a callback method on all triangles of the concave shape inside a given AABB.

Implemented in reactphysics3d::HeightFieldShape.

◆ getLocalInertiaTensor()

RP3D_FORCE_INLINE Vector3 reactphysics3d::ConcaveShape::getLocalInertiaTensor ( decimal  mass) const
overridevirtual

Return the local inertia tensor of the collision shape.

Parameters
massMass to use to compute the inertia tensor of the collision shape

Implements reactphysics3d::CollisionShape.

◆ getVolume()

decimal ConcaveShape::getVolume ( ) const
overridevirtual

Compute and return the volume of the collision shape.

Note that we approximate the volume of a concave shape with the volume of its AABB.

Implements reactphysics3d::CollisionShape.

◆ isConvex()

RP3D_FORCE_INLINE bool reactphysics3d::ConcaveShape::isConvex ( ) const
overridevirtual

Return true if the collision shape is convex, false if it is concave.

Implements reactphysics3d::CollisionShape.

◆ isPolyhedron()

RP3D_FORCE_INLINE bool reactphysics3d::ConcaveShape::isPolyhedron ( ) const
overridevirtual

Return true if the collision shape is a polyhedron.

Implements reactphysics3d::CollisionShape.

◆ setRaycastTestType()

RP3D_FORCE_INLINE void reactphysics3d::ConcaveShape::setRaycastTestType ( TriangleRaycastSide  testType)
Parameters
testTypeRaycast test type for the triangle (front, back, front-back)

◆ setScale()

RP3D_FORCE_INLINE void reactphysics3d::ConcaveShape::setScale ( const Vector3 scale)
virtual

Set the scale of the shape.

Note that you might want to recompute the inertia tensor and center of mass of the body after changing the scale of a collision shape.

Reimplemented in reactphysics3d::ConcaveMeshShape.


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