Back to class index

Class AABB


A 3D axis-aligned bounding box.


This data structure can be used to represent coarse bounds of objects, in situations where detailed triangle-level computations can be avoided. In physics systems, bounding boxes are used as an efficient early-out test for geometry intersection queries.

The 'axis-aligned' part in the name means that the local axes of this bounding box are restricted to align with the axes of the world space coordinate system. This makes computations involving AABB's very fast, since AABB's cannot be arbitrarily oriented in the space with respect to each other.

If you need to represent a box in 3D space with arbitrary orientation, see the class OBB.

Member Reference

AABBA 3D axis-aligned bounding box.
minPointSpecifies the minimum extent of this AABB in the world space x, y and z axes.
maxPointSpecifies the maximum extent of this AABB in the world space x, y and z axes.
ctor (+3 overloads)The default constructor does not initialize any members of this class.
MinX()[const]Returns the minimum world-space coordinate along the given axis.
MaxX()[const]Returns the maximum world-space coordinate along the given axis.
SetNegativeInfinity()Sets this structure to a degenerate AABB that does not have any volume.
SetFromCenterAndSize(center,size)Sets this AABB by specifying its center and size.
SetFrom(obb) (+2 overloads)Sets this AABB to enclose the given OBB.
ToPolyhedron()[const]Converts this AABB to a polyhedron.
ToOBB()[const]Converts this AABB to an OBB.
MinimalEnclosingSphere()[const]Returns the smallest sphere that contains this AABB.
MaximalContainedSphere()[const]Returns the largest sphere that can fit inside this AABB.
IsFinite()[const]Tests if this AABB is finite.
IsDegenerate()[const]Tests if this AABB is degenerate.
CenterPoint()[const]Returns the center point of this AABB.
PointInside(x,y,z)[const]Generates a point inside this AABB.
Edge(edgeIndex)[const]Returns an edge of this AABB.
CornerPoint(cornerIndex)[const]Returns a corner point of this AABB.
PointOnEdge(edgeIndex,u)[const]Returns a point on an edge of this AABB.
FaceCenterPoint(faceIndex)[const]Returns the point at the center of the given face of this AABB.
FacePoint(faceIndex,u,v)[const]Generates a point at the surface of the given face of this AABB.
FaceNormal(faceIndex)[const]Returns the surface normal direction vector the given face points towards.
FacePlane(faceIndex)[const]Computes the plane equation of the given face of this AABB.
GetCornerPoints(outPointArray)[const]Fills an array with all the eight corner points of this AABB.
GetFacePlanes(outPlaneArray)[const]Fills an array with all the six planes of this AABB.
Size()[const]Returns the side lengths of this AABB in x, y and z directions.
HalfSize()[const]Returns Size()/2
Diagonal()[const]Returns the diameter vector of this AABB.
HalfDiagonal()[const]Returns Diagonal()/2
Volume()[const]Computes the volume of this AABB.
SurfaceArea()[const]Computes the surface area of the faces of this AABB.
RandomPointInside(rng)[const]Generates a random point inside this AABB.
RandomPointOnSurface(rng)[const]Generates a random point on a random face of this AABB.
RandomPointOnEdge(rng)[const]Generates a random point on a random edge of this AABB.
RandomCornerPoint(rng)[const]Picks a random corner point of this AABB.
Translate(offset)Translates this AABB in world space.
Scale(...) (+1 overload)Applies a uniform scale to this AABB.
TransformAsAABB(transform) (+3 overloads)Applies a transformation to this AABB.
Transform(transform)[const] (+3 overloads)Applies a transformation to this AABB and returns the resulting OBB.
ClosestPoint(targetPoint)[const]Computes the closest point inside this AABB to the given point.
Distance(point)[const] (+1 overload)Computes the distance between this AABB and the given object.
Contains(point)[const] (+8 overloads)Tests if the given object is fully contained inside this AABB.
Intersects(ray,dNear,dFar)[const] (+11 overloads)Tests whether this AABB and the given object intersect.
ProjectToAxis(axis,dMin,dMax)[const]Projects this AABB onto the given axis.
Enclose(point) (+10 overloads)Expands this AABB to enclose the given object.
Triangulate(...)[const]Generates an unindexed triangle mesh representation of this AABB.
ToEdgeList(outPos)[const]Generates an edge list representation of the edges of this AABB.
Intersection(aabb)[const]Finds the set intersection of this and the given AABB.
IntersectRayAABB(...)[const]Computes the intersection of a ray and a AABB.
MinimalEnclosingAABB(...)[static]Generates an AABB that encloses the given point set.
ExtremePointsAlongAABB(...)[static]Finds the most extremal points along the three world axes simultaneously.
FromCenterAndSize(...)[static]Creates a new AABB given is center position and size along the X, Y and Z axes.
NumVerticesInTriangulation(...)[static]Returns the number of vertices that the Triangulate() function will output with the given subdivision parameters.
NumVerticesInEdgeList()[static]Returns the number of vertices that the ToEdgeList() function will output.
Back to class index