Back to class index
AABB[Class Summary]
minPoint
maxPoint
ctor (+3 overloads)
MinX()[const]
MinY()[const]
MinZ()[const]
MaxX()[const]
MaxY()[const]
MaxZ()[const]
SetNegativeInfinity()
SetFromCenterAndSize(center,size)
SetFrom(obb) (+2 overloads)
ToPolyhedron()[const]
ToPBVolume()[const]
ToOBB()[const]
MinimalEnclosingSphere()[const]
MaximalContainedSphere()[const]
IsFinite()[const]
IsDegenerate()[const]
CenterPoint()[const]
Centroid()[const]
AnyPointFast()[const]
PointInside(x,y,z)[const]
Edge(edgeIndex)[const]
CornerPoint(cornerIndex)[const]
ExtremePoint(direction)[const] (+1 overload)
PointOnEdge(edgeIndex,u)[const]
FaceCenterPoint(faceIndex)[const]
FacePoint(faceIndex,u,v)[const]
FaceNormal(faceIndex)[const]
FacePlane(faceIndex)[const]
GetCornerPoints(outPointArray)[const]
GetFacePlanes(outPlaneArray)[const]
Size()[const]
HalfSize()[const]
Diagonal()[const]
HalfDiagonal()[const]
Volume()[const]
SurfaceArea()[const]
RandomPointInside(rng)[const]
RandomPointOnSurface(rng)[const]
RandomPointOnEdge(rng)[const]
RandomCornerPoint(rng)[const]
Translate(offset)
Scale(...) (+1 overload)
TransformAsAABB(transform) (+3 overloads)
Transform(transform)[const] (+3 overloads)
ClosestPoint(targetPoint)[const]
Distance(point)[const] (+1 overload)
Contains(point)[const] (+10 overloads)
Intersects(ray,dNear,dFar)[const] (+14 overloads)
ProjectToAxis(axis,dMin,dMax)[const]
UniqueFaceNormals(out)[const]
UniqueEdgeDirections(out)[const]
Enclose(point) (+11 overloads)
Triangulate(...)[const]
ToEdgeList(outPos)[const]
ToString()[const]
SerializeToString()[const]
SerializeToCodeString()[const]
Intersection(aabb)[const]
IntersectLineAABB(...)[const]
IntersectLineAABB_CPP(...)[const]
Equals(rhs,epsilon)[const]
BitEquals(other)[const]
NumFaces()[static]
NumEdges()[static]
NumVertices()[static]
MinimalEnclosingAABB(...)[static]
ExtremePointsAlongAABB(...)[static]
FromCenterAndSize(...)[static]
NumVerticesInTriangulation(...)[static]
NumVerticesInEdgeList()[static]
FromString(str,outEndStr)[static] (+1 overload)

AABB::Intersects

Syntax

bool AABB::Intersects(const Ray &ray, float &dNear, float &dFar) const; [6 lines of code]
bool AABB::Intersects(const Ray &ray) const; [11 lines of code]
bool AABB::Intersects(const Line &line, float &dNear, float &dFar) const; [6 lines of code]
bool AABB::Intersects(const Line &line) const; [11 lines of code]
bool AABB::Intersects(const LineSegment &lineSegment, float &dNear, float &dFar) const; [19 lines of code]
bool AABB::Intersects(const LineSegment &lineSegment) const; [16 lines of code]
bool AABB::Intersects(const Plane &plane) const; [4 lines of code]
bool AABB::Intersects(const AABB &aabb) const; [29 lines of code]
bool AABB::Intersects(const OBB &obb) const; [4 lines of code]
bool AABB::Intersects(const Sphere &sphere, float4 *closestPointOnAABB=0) const; [11 lines of code]
bool AABB::Intersects(const Capsule &capsule) const; [4 lines of code]
bool AABB::Intersects(const Triangle &triangle) const; [4 lines of code]
bool AABB::Intersects(const Polygon &polygon) const; [4 lines of code]
bool AABB::Intersects(const Frustum &frustum) const; [4 lines of code]
bool AABB::Intersects(const Polyhedron &polyhedron) const; [4 lines of code]

Tests whether this AABB and the given object intersect.

Both objects are treated as "solid", meaning that if one of the objects is fully contained inside another, this function still returns true. (e.g. in case a line segment is contained inside this AABB, or this AABB is contained inside a Sphere, etc.)

Note
If you do not need the intersection intervals, you should call the functions without these parameters in the function signature for optimal performance.

For reference documentation on the Sphere-AABB intersection test, see Christer Ericson's Real-Time Collision Detection, p.

  • Parameters

    const Ray &rayThe first parameter of this function specifies the other object to test against. float &dNear [out]If specified, receives the parametric distance along the line denoting where the line entered this AABB.float &dFar [out]If specified, receives the parametric distance along the line denoting where the line exited this AABB.const Sphere &sphereThe first parameter of this function specifies the other object to test against. float4 *closestPointOnAABB [out]Returns the closest point on this AABB to the given sphere. This pointer may be null.

    See Also

    Contains(), Distance(), ClosestPoint().

    Work in progress:

    Todo: in bool AABB::Intersects(const Ray &ray, float &dNear, float &dFar) const:
    Add Intersects(Circle/Disc).