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

This class represents a triangle collision shape that is centered at the origin and defined three points. More...

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

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

Public Member Functions

 TriangleShape (const TriangleShape &shape)=delete
 Deleted copy-constructor.
 
TriangleShapeoperator= (const TriangleShape &shape)=delete
 Deleted assignment operator.
 
virtual AABB getLocalBounds () const override
 Return the local bounds of the shape in x, y and z directions.
 
virtual Vector3 getLocalInertiaTensor (decimal mass) const override
 Return the local inertia tensor of the collision shape.
 
virtual AABB computeTransformedAABB (const Transform &transform) const override
 Compute the transformed AABB of the collision shape given a transform.
 
TriangleRaycastSide getRaycastTestType () const
 Return the raycast test type (front, back, front-back)
 
void setRaycastTestType (TriangleRaycastSide testType)
 
virtual uint32 getNbFaces () const override
 Return the number of faces of the polyhedron.
 
virtual const HalfEdgeStructure::FacegetFace (uint32 faceIndex) const override
 Return a given face of the polyhedron.
 
virtual uint32 getNbVertices () const override
 Return the number of vertices of the polyhedron.
 
virtual const HalfEdgeStructure::VertexgetVertex (uint32 vertexIndex) const override
 Return a given vertex of the polyhedron.
 
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 polyhedron.
 
virtual uint32 getNbHalfEdges () const override
 Return the number of half-edges of the polyhedron.
 
virtual const HalfEdgeStructure::EdgegetHalfEdge (uint32 edgeIndex) const override
 Return a given half-edge of the polyhedron.
 
virtual Vector3 getCentroid () const override
 Return the centroid of the polyhedron.
 
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.
 
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.
 
CollisionShapeType getType () const
 Return the type of the collision shape.
 
uint32 getId () const
 Return the id of the shape.
 

Static Public Member Functions

static void computeSmoothTriangleMeshContact (const CollisionShape *shape1, const CollisionShape *shape2, Vector3 &localContactPointShape1, Vector3 &localContactPointShape2, const Transform &shape1ToWorld, const Transform &shape2ToWorld, decimal penetrationDepth, Vector3 &outSmoothVertexNormal)
 This method compute the smooth mesh contact with a triangle in case one of the two collision shapes is a triangle. The idea in this case is to use a smooth vertex normal of the triangle mesh.
 

Detailed Description

This class represents a triangle collision shape that is centered at the origin and defined three points.

A user cannot instanciate an object of this class. This class is for internal use only. Instances of this class are created when the user creates an HeightFieldShape and a ConcaveMeshShape

Member Function Documentation

◆ computeTransformedAABB()

AABB TriangleShape::computeTransformedAABB ( const Transform transform) const
overridevirtual

Compute the transformed AABB of the collision shape given a transform.

Parameters
transformTransform to use for the space conversion
Returns
aabb The transformed axis-aligned bounding box (AABB) of the collision shape

Reimplemented from reactphysics3d::CollisionShape.

◆ getCentroid()

RP3D_FORCE_INLINE Vector3 reactphysics3d::TriangleShape::getCentroid ( ) const
overridevirtual

Return the centroid of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getFace()

RP3D_FORCE_INLINE const HalfEdgeStructure::Face & reactphysics3d::TriangleShape::getFace ( uint32  faceIndex) const
overridevirtual

Return a given face of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getFaceNormal()

RP3D_FORCE_INLINE Vector3 reactphysics3d::TriangleShape::getFaceNormal ( uint32  faceIndex) const
overridevirtual

Return the normal vector of a given face of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getHalfEdge()

RP3D_FORCE_INLINE const HalfEdgeStructure::Edge & reactphysics3d::TriangleShape::getHalfEdge ( uint32  edgeIndex) const
overridevirtual

Return a given half-edge of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getLocalBounds()

RP3D_FORCE_INLINE AABB reactphysics3d::TriangleShape::getLocalBounds ( ) const
overridevirtual

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

Returns
The AABB with the min/max bounds of the shape

Implements reactphysics3d::CollisionShape.

◆ getLocalInertiaTensor()

RP3D_FORCE_INLINE Vector3 reactphysics3d::TriangleShape::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
Returns
A vector with the three diagonal values of the local inertia tensor

Implements reactphysics3d::CollisionShape.

◆ getNbFaces()

RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleShape::getNbFaces ( ) const
overridevirtual

Return the number of faces of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getNbHalfEdges()

RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleShape::getNbHalfEdges ( ) const
overridevirtual

Return the number of half-edges of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getNbVertices()

RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleShape::getNbVertices ( ) const
overridevirtual

Return the number of vertices of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getVertex()

RP3D_FORCE_INLINE const HalfEdgeStructure::Vertex & reactphysics3d::TriangleShape::getVertex ( uint32  vertexIndex) const
overridevirtual

Return a given vertex of the polyhedron.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getVertexPosition()

RP3D_FORCE_INLINE Vector3 reactphysics3d::TriangleShape::getVertexPosition ( uint32  vertexIndex) const
overridevirtual

Return the position of a given vertex.

Implements reactphysics3d::ConvexPolyhedronShape.

◆ getVolume()

RP3D_FORCE_INLINE decimal reactphysics3d::TriangleShape::getVolume ( ) const
overridevirtual

Compute and return the volume of the collision shape.

Implements reactphysics3d::CollisionShape.

◆ setRaycastTestType()

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

◆ to_string()

RP3D_FORCE_INLINE std::string reactphysics3d::TriangleShape::to_string ( ) const
overridevirtual

Return the string representation of the shape.

Implements reactphysics3d::CollisionShape.


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