ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::ConvexMeshShape Class Reference

This class represents a convex mesh shape. More...

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

Inheritance diagram for reactphysics3d::ConvexMeshShape:
reactphysics3d::ConvexPolyhedronShape reactphysics3d::ConvexShape reactphysics3d::CollisionShape

Public Member Functions

 ConvexMeshShape (const ConvexMeshShape &shape)=delete
 Deleted copy-constructor.
 
ConvexMeshShapeoperator= (const ConvexMeshShape &shape)=delete
 Deleted assignment operator.
 
const Vector3getScale () const
 Return the scale.
 
void setScale (const Vector3 &scale)
 Set the scale. More...
 
virtual AABB getLocalBounds () const override
 Return the local bounds of the shape in x, y and z directions. More...
 
virtual Vector3 getLocalInertiaTensor (decimal mass) const override
 Return the local inertia tensor of the collision shape. More...
 
virtual uint32 getNbFaces () const override
 Return the number of faces of the mesh.
 
virtual const HalfEdgeStructure::FacegetFace (uint32 faceIndex) const override
 Return a given face of the mesh.
 
virtual uint32 getNbVertices () const override
 Return the number of vertices of the mesh.
 
virtual const HalfEdgeStructure::VertexgetVertex (uint32 vertexIndex) const override
 Return a given vertex of the mesh.
 
virtual uint32 getNbHalfEdges () const override
 Return the number of half-edges of the mesh.
 
virtual const HalfEdgeStructure::EdgegetHalfEdge (uint32 edgeIndex) const override
 Return a given half-edge of the mesh.
 
virtual Vector3 getVertexPosition (uint32 vertexIndex) const override
 Return the position of a given vertex.
 
virtual Vector3 getFaceNormal (uint32 faceIndex) const override
 Return the normal vector of a given face of the mesh.
 
virtual Vector3 getCentroid () const override
 Return the centroid of the mesh.
 
virtual decimal getVolume () const override
 Compute and return the volume of the collision shape.
 
virtual std::string to_string () const override
 Return the string representation of the shape.
 
- Public Member Functions inherited from reactphysics3d::ConvexPolyhedronShape
 ConvexPolyhedronShape (CollisionShapeName name, MemoryAllocator &allocator)
 Constructor.
 
virtual ~ConvexPolyhedronShape () override=default
 Destructor.
 
 ConvexPolyhedronShape (const ConvexPolyhedronShape &shape)=delete
 Deleted copy-constructor.
 
ConvexPolyhedronShapeoperator= (const ConvexPolyhedronShape &shape)=delete
 Deleted assignment operator.
 
virtual bool isPolyhedron () const override
 Return true if the collision shape is a polyhedron.
 
uint32 findMostAntiParallelFace (const Vector3 &direction) const
 Find and return the index of the polyhedron face with the most anti-parallel face normal given a direction vector.
 
- Public Member Functions inherited from reactphysics3d::ConvexShape
 ConvexShape (CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator, decimal margin=decimal(0.0))
 Constructor.
 
virtual ~ConvexShape () override=default
 Destructor.
 
 ConvexShape (const ConvexShape &shape)=delete
 Deleted copy-constructor.
 
ConvexShapeoperator= (const ConvexShape &shape)=delete
 Deleted assignment operator.
 
decimal getMargin () const
 Return the current object margin. More...
 
virtual bool isConvex () const override
 Return true if the collision shape is convex, false if it is concave.
 
- 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. More...
 
CollisionShapeType getType () const
 Return the type of the collision shape. More...
 
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. More...
 

Detailed Description

This class represents a convex mesh shape.

In order to create a convex mesh shape, you need to indicate the local-space position of the mesh vertices. The center of mass of the shape will be at the origin of the local-space geometry that you use to create the mesh.

Member Function Documentation

◆ getLocalBounds()

AABB ConvexMeshShape::getLocalBounds ( ) const
overridevirtual

Return the local bounds of the shape in x, y and z directions.

Returns
The AABB with the min/max bounds

Implements reactphysics3d::CollisionShape.

◆ getLocalInertiaTensor()

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

Return the local inertia tensor of the collision shape.

The local inertia tensor of the convex mesh is approximated using the inertia tensor of its bounding box.

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

Implements reactphysics3d::CollisionShape.

◆ setScale()

RP3D_FORCE_INLINE void reactphysics3d::ConvexMeshShape::setScale ( const Vector3 scale)

Set the scale.

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.


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