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

This class represents a bounding volume of type "Axis Aligned Bounding Box". More...

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

Public Member Functions

 AABB ()=default
 Constructor.
 
 AABB (const Vector3 &minCoordinates, const Vector3 &maxCoordinates)
 Constructor.
 
Vector3 getCenter () const
 Return the center point.
 
const Vector3getMin () const
 Return the minimum coordinates of the AABB.
 
void setMin (const Vector3 &min)
 Set the minimum coordinates of the AABB.
 
const Vector3getMax () const
 Return the maximum coordinates of the AABB.
 
void setMax (const Vector3 &max)
 Set the maximum coordinates of the AABB.
 
Vector3 getExtent () const
 Return the size of the AABB in the three dimension x, y and z.
 
void inflate (decimal dx, decimal dy, decimal dz)
 Inflate each side of the AABB by a given size.
 
void inflateWithPoint (const Vector3 &point)
 Inflate (if necessary) to make sure that a given point fit inside it.
 
bool testCollision (const AABB &aabb) const
 Return true if the current AABB is overlapping with the AABB in argument.
 
decimal getVolume () const
 Return the volume of the AABB.
 
void mergeWithAABB (const AABB &aabb)
 Merge the AABB in parameter with the current one.
 
void mergeTwoAABBs (const AABB &aabb1, const AABB &aabb2)
 Replace the current AABB with a new AABB that is the union of two AABBs in parameters.
 
bool contains (const AABB &aabb) const
 Return true if the current AABB contains the AABB given in parameter.
 
bool contains (const Vector3 &point, decimal epsilon=MACHINE_EPSILON) const
 Return true if a point is inside the AABB.
 
bool testCollisionTriangleAABB (const Vector3 *trianglePoints) const
 Return true if the AABB of a triangle intersects the AABB.
 
bool testRayIntersect (const Vector3 &rayOrigin, const Vector3 &rayDirectionInv, decimal rayMaxFraction) const
 Return true if the ray intersects the AABB.
 
bool raycast (const Ray &ray, Vector3 &hitPoint) const
 Compute the intersection of a ray and the AABB.
 
void applyScale (const Vector3 &scale)
 Apply a scale factor to the AABB.
 

Static Public Member Functions

static AABB createAABBForTriangle (const Vector3 *trianglePoints)
 Create and return an AABB for a triangle.
 

Detailed Description

This class represents a bounding volume of type "Axis Aligned Bounding Box".

It's a box where all the edges are always aligned with the world coordinate system. The AABB is defined by the minimum and maximum world coordinates of the three axis.

Member Function Documentation

◆ testCollision()

RP3D_FORCE_INLINE bool reactphysics3d::AABB::testCollision ( const AABB aabb) const

Return true if the current AABB is overlapping with the AABB in argument.

Two AABBs overlap if they overlap in the three x, y and z axis at the same time.


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