ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class represents a 3D box shape. More...
#include <include/reactphysics3d/collision/shapes/BoxShape.h>
Public Member Functions | |
BoxShape (const BoxShape &shape)=delete | |
Deleted copy-constructor. | |
BoxShape & | operator= (const BoxShape &shape)=delete |
Deleted assignment operator. | |
const Vector3 & | getHalfExtents () const |
Return the half-extents of the box. | |
void | setHalfExtents (const Vector3 &halfExtents) |
Set the half-extents of the box. | |
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 decimal | getVolume () const override |
Compute and return the volume of the collision shape. | |
virtual uint32 | getNbFaces () const override |
Return the number of faces of the polyhedron. | |
virtual const HalfEdgeStructure::Face & | getFace (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::Vertex & | getVertex (uint32 vertexIndex) const override |
Return a given vertex of the polyhedron. | |
virtual uint32 | getNbHalfEdges () const override |
Return the number of half-edges of the polyhedron. | |
virtual const HalfEdgeStructure::Edge & | getHalfEdge (uint32 edgeIndex) const override |
Return a given half-edge 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 Vector3 | getCentroid () const override |
Return the centroid of the polyhedron. | |
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. | |
ConvexPolyhedronShape & | operator= (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. | |
ConvexShape & | operator= (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. | |
CollisionShape & | operator= (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. | |
virtual AABB | computeTransformedAABB (const Transform &transform) const |
Compute the transformed AABB of the collision shape given a transform. | |
This class represents a 3D box shape.
Those axis are unit length. The three extents are half-widths of the box along the three axis x, y, z local axis. The "transform" of the corresponding body will give an orientation and a position to the box.
|
overridevirtual |
Return the centroid of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return a given face of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return the normal vector of a given face of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return a given half-edge of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
RP3D_FORCE_INLINE const Vector3 & reactphysics3d::BoxShape::getHalfExtents | ( | ) | const |
Return the half-extents of the box.
|
overridevirtual |
Return the local bounds of the shape in x, y and z directions.
This method is used to compute the AABB of the box.
Implements reactphysics3d::CollisionShape.
|
overridevirtual |
Return the local inertia tensor of the collision shape.
mass | Mass to use to compute the inertia tensor of the collision shape |
Implements reactphysics3d::CollisionShape.
|
overridevirtual |
Return the number of faces of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return the number of half-edges of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return the number of vertices of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return a given vertex of the polyhedron.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Return the position of a given vertex.
Implements reactphysics3d::ConvexPolyhedronShape.
|
overridevirtual |
Compute and return the volume of the collision shape.
Implements reactphysics3d::CollisionShape.
RP3D_FORCE_INLINE void reactphysics3d::BoxShape::setHalfExtents | ( | const Vector3 & | halfExtents | ) |
Set the half-extents of the box.
Note that you might want to recompute the inertia tensor and center of mass of the body after changing the size of the collision shape.
halfExtents | The vector with the three half-extents of the box |
|
overridevirtual |
Return the string representation of the shape.
Implements reactphysics3d::CollisionShape.